if Key_R is set to multiple mods, then it'll use them all now. but Key_L still takes precidence if they are different

This commit is contained in:
Dana Jansens 2007-06-07 04:55:21 +00:00
parent a97f6faba5
commit 4cf8fd5c23

View file

@ -41,6 +41,11 @@ static gint min_keycode, max_keycode, keysyms_per_keycode;
/* This is a bitmask of the different masks for each modifier key */ /* This is a bitmask of the different masks for each modifier key */
static guchar modkeys_keys[OB_MODKEY_NUM_KEYS]; static guchar modkeys_keys[OB_MODKEY_NUM_KEYS];
static gboolean alt_l = FALSE;
static gboolean meta_l = FALSE;
static gboolean super_l = FALSE;
static gboolean hyper_l = FALSE;
void modkeys_startup(gboolean reconfigure) void modkeys_startup(gboolean reconfigure)
{ {
gint i, j, k; gint i, j, k;
@ -57,6 +62,8 @@ void modkeys_startup(gboolean reconfigure)
max_keycode - min_keycode + 1, max_keycode - min_keycode + 1,
&keysyms_per_keycode); &keysyms_per_keycode);
alt_l = meta_l = super_l = hyper_l = FALSE;
/* go through each of the modifier masks (eg ShiftMask, CapsMask...) */ /* go through each of the modifier masks (eg ShiftMask, CapsMask...) */
for (i = 0; i < NUM_MASKS; ++i) { for (i = 0; i < NUM_MASKS; ++i) {
/* go through each keycode that is bound to the mask */ /* go through each keycode that is bound to the mask */
@ -135,18 +142,37 @@ static void set_modkey_mask(guchar mask, KeySym sym)
modkeys_keys[OB_MODKEY_KEY_NUMLOCK] |= mask; modkeys_keys[OB_MODKEY_KEY_NUMLOCK] |= mask;
else if (sym == XK_Scroll_Lock) else if (sym == XK_Scroll_Lock)
modkeys_keys[OB_MODKEY_KEY_SCROLLLOCK] |= mask; modkeys_keys[OB_MODKEY_KEY_SCROLLLOCK] |= mask;
else if (sym == XK_Super_L ||
(sym == XK_Super_R && !modkeys_keys[OB_MODKEY_KEY_SUPER])) else if (sym == XK_Super_L && super_l)
modkeys_keys[OB_MODKEY_KEY_SUPER] |= mask; modkeys_keys[OB_MODKEY_KEY_SUPER] |= mask;
else if (sym == XK_Hyper_L || else if (sym == XK_Super_L && !super_l)
(sym == XK_Hyper_R && !modkeys_keys[OB_MODKEY_KEY_HYPER])) /* left takes precident over right, so erase any masks the right
key may have set */
modkeys_keys[OB_MODKEY_KEY_SUPER] = mask, super_l = TRUE;
else if (sym == XK_Super_R && !super_l)
modkeys_keys[OB_MODKEY_KEY_SUPER] |= mask;
else if (sym == XK_Hyper_L && hyper_l)
modkeys_keys[OB_MODKEY_KEY_HYPER] |= mask; modkeys_keys[OB_MODKEY_KEY_HYPER] |= mask;
else if (sym == XK_Alt_L || else if (sym == XK_Hyper_L && !hyper_l)
(sym == XK_Alt_R && !modkeys_keys[OB_MODKEY_KEY_ALT])) modkeys_keys[OB_MODKEY_KEY_HYPER] = mask, hyper_l = TRUE;
else if (sym == XK_Hyper_R && !hyper_l)
modkeys_keys[OB_MODKEY_KEY_HYPER] |= mask;
else if (sym == XK_Alt_L && alt_l)
modkeys_keys[OB_MODKEY_KEY_ALT] |= mask; modkeys_keys[OB_MODKEY_KEY_ALT] |= mask;
else if (sym == XK_Meta_L || else if (sym == XK_Alt_L && !alt_l)
(sym == XK_Meta_R && !modkeys_keys[OB_MODKEY_KEY_META])) modkeys_keys[OB_MODKEY_KEY_ALT] = mask, alt_l = TRUE;
else if (sym == XK_Alt_R && !alt_l)
modkeys_keys[OB_MODKEY_KEY_ALT] |= mask;
else if (sym == XK_Meta_L && meta_l)
modkeys_keys[OB_MODKEY_KEY_META] |= mask; modkeys_keys[OB_MODKEY_KEY_META] |= mask;
else if (sym == XK_Meta_L && !meta_l)
modkeys_keys[OB_MODKEY_KEY_META] = mask, meta_l = TRUE;
else if (sym == XK_Meta_R && !meta_l)
modkeys_keys[OB_MODKEY_KEY_META] |= mask;
/* CapsLock, Shift, and Control are special and hard-coded */ /* CapsLock, Shift, and Control are special and hard-coded */
} }