From 28859c604fa3cc12353c8f7b6981466195649692 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 26 Feb 2014 19:01:52 +0100 Subject: [PATCH] keybindings: Don't use the keysym to match keybindings We don't want to match the keysym so that e.g. an accelerator specified as "a" works if the current keymap has a keysym other than 'a' for that keycode which means that the accelerator would become inaccessible in a non-latin keymap. This is inconvenient for users that often switch keyboard layouts, or even have different layouts in different windows, since they expect system-level keybindings to not be affected by the current layout. https://bugzilla.gnome.org/show_bug.cgi?id=678001 --- src/core/keybindings.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 96c34024a..6004829c9 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -747,7 +747,6 @@ grab_key_bindings (MetaDisplay *display) static MetaKeyBinding * display_get_keybinding (MetaDisplay *display, - unsigned int keysym, unsigned int keycode, unsigned long mask) { @@ -756,8 +755,7 @@ display_get_keybinding (MetaDisplay *display, i = display->n_key_bindings - 1; while (i >= 0) { - if (display->key_bindings[i].keysym == keysym && - display->key_bindings[i].keycode == keycode && + if (display->key_bindings[i].keycode == keycode && display->key_bindings[i].mask == mask) { return &display->key_bindings[i]; @@ -907,7 +905,6 @@ meta_display_get_keybinding_action (MetaDisplay *display, unsigned long mask) { MetaKeyBinding *binding; - KeySym keysym; /* This is much more vague than the MetaDisplay::overlay-key signal, * which is only emitted if the overlay-key is the only key pressed; @@ -918,12 +915,8 @@ meta_display_get_keybinding_action (MetaDisplay *display, if (keycode == (unsigned int)display->overlay_key_combo.keycode) return META_KEYBINDING_ACTION_OVERLAY_KEY; - keysym = XKeycodeToKeysym (display->xdisplay, keycode, 0); mask = mask & 0xff & ~display->ignored_modifier_mask; - binding = display_get_keybinding (display, keysym, keycode, mask); - - if (!binding && keycode == meta_display_get_above_tab_keycode (display)) - binding = display_get_keybinding (display, META_KEY_ABOVE_TAB, keycode, mask); + binding = display_get_keybinding (display, keycode, mask); if (binding) { @@ -1695,7 +1688,7 @@ process_event (MetaKeyBinding *bindings, MetaKeyHandler *handler = bindings[i].handler; if ((!window && handler->flags & META_KEY_BINDING_PER_WINDOW) || - (event->keyval != bindings[i].keysym) || + (event->hardware_keycode != bindings[i].keycode) || (event->modifier_state != bindings[i].mask) || meta_compositor_filter_keybinding (display->compositor, screen, &bindings[i])) continue; @@ -1781,7 +1774,6 @@ process_overlay_key (MetaDisplay *display, XIAsyncDevice, event->time); binding = display_get_keybinding (display, - display->overlay_key_combo.keysym, display->overlay_key_combo.keycode, display->grab_mask); if (binding &&