diff options
author | cos <cos> | 2019-01-10 22:08:25 +0100 |
---|---|---|
committer | cos <cos> | 2019-01-10 22:08:25 +0100 |
commit | 94e81d179d20413d8fe1aa9c3e20583887059b6a (patch) | |
tree | dc0fc56f072b5e36b163abfcd8c4b61d9b056ece | |
parent | b42faf87f2961526222a05530eaef9d31e9d33f2 (diff) | |
download | ratpoison-94e81d179d20413d8fe1aa9c3e20583887059b6a.zip |
Make AltGr a key modifier with prefix Ghax/altgr_support
This code kind of works for me, but no thought has been put into correct implementation.
-rw-r--r-- | src/actions.c | 4 | ||||
-rw-r--r-- | src/data.h | 2 | ||||
-rw-r--r-- | src/input.c | 11 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c index e65ca0c..14828b7 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1215,6 +1215,10 @@ parse_keydesc (char *keydesc, struct rp_key *key) { key->state |= RP_ALT_MASK; } + else if (!strcmp (token, "G")) + { + key->state |= RP_ALTGR_MASK; + } else if (!strcmp (token, "S")) { key->state |= RP_SHIFT_MASK; @@ -341,12 +341,14 @@ struct rp_child_info #define RP_ALT_MASK 8 #define RP_SUPER_MASK 16 #define RP_HYPER_MASK 32 +#define RP_ALTGR_MASK 64 struct modifier_info { /* unsigned int mode_switch_mask; */ unsigned int meta_mod_mask; unsigned int alt_mod_mask; + unsigned int altgr_mod_mask; unsigned int super_mod_mask; unsigned int hyper_mod_mask; diff --git a/src/input.c b/src/input.c index c71d58c..7d27a77 100644 --- a/src/input.c +++ b/src/input.c @@ -47,6 +47,7 @@ x11_mask_to_rp_mask (unsigned int mask) result |= mask & ControlMask ? RP_CONTROL_MASK:0; result |= mask & rp_modifier_info.meta_mod_mask ? RP_META_MASK:0; result |= mask & rp_modifier_info.alt_mod_mask ? RP_ALT_MASK:0; + result |= mask & rp_modifier_info.altgr_mod_mask ? RP_ALTGR_MASK:0; result |= mask & rp_modifier_info.hyper_mod_mask ? RP_HYPER_MASK:0; result |= mask & rp_modifier_info.super_mod_mask ? RP_SUPER_MASK:0; @@ -69,6 +70,7 @@ rp_mask_to_x11_mask (unsigned int mask) result |= mask & RP_CONTROL_MASK ? ControlMask:0; result |= mask & RP_META_MASK ? rp_modifier_info.meta_mod_mask:0; result |= mask & RP_ALT_MASK ? rp_modifier_info.alt_mod_mask:0; + result |= mask & RP_ALTGR_MASK ? rp_modifier_info.altgr_mod_mask:0; result |= mask & RP_HYPER_MASK ? rp_modifier_info.hyper_mod_mask:0; result |= mask & RP_SUPER_MASK ? rp_modifier_info.super_mod_mask:0; @@ -139,6 +141,7 @@ update_modifier_map (void) rp_modifier_info.meta_mod_mask = 0; rp_modifier_info.alt_mod_mask = 0; + rp_modifier_info.altgr_mod_mask = 0; rp_modifier_info.super_mod_mask = 0; rp_modifier_info.hyper_mod_mask = 0; rp_modifier_info.num_lock_mask = 0; @@ -187,6 +190,13 @@ update_modifier_map (void) rp_modifier_info.alt_mod_mask)); break; + case XK_ISO_Level3_Shift: + found_alt_or_meta = 1; + rp_modifier_info.altgr_mod_mask |= modmasks[row - 3]; + PRINT_DEBUG (("Found Alt on %d\n", + rp_modifier_info.altgr_mod_mask)); + break; + case XK_Super_L: case XK_Super_R: if (!found_alt_or_meta) @@ -377,6 +387,7 @@ cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_nam *mod = ev->state; *mod &= (rp_modifier_info.meta_mod_mask | rp_modifier_info.alt_mod_mask + | rp_modifier_info.altgr_mod_mask | rp_modifier_info.hyper_mod_mask | rp_modifier_info.super_mod_mask | ControlMask |