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 "<Super>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
This commit is contained in:
Rui Matos 2014-02-26 19:01:52 +01:00
parent 585fdd781c
commit 2bf844d585

View File

@ -749,7 +749,6 @@ grab_key_bindings (MetaDisplay *display)
static MetaKeyBinding * static MetaKeyBinding *
display_get_keybinding (MetaDisplay *display, display_get_keybinding (MetaDisplay *display,
unsigned int keysym,
unsigned int keycode, unsigned int keycode,
unsigned long mask) unsigned long mask)
{ {
@ -758,8 +757,7 @@ display_get_keybinding (MetaDisplay *display,
i = display->n_key_bindings - 1; i = display->n_key_bindings - 1;
while (i >= 0) while (i >= 0)
{ {
if (display->key_bindings[i].keysym == keysym && if (display->key_bindings[i].keycode == keycode &&
display->key_bindings[i].keycode == keycode &&
display->key_bindings[i].mask == mask) display->key_bindings[i].mask == mask)
{ {
return &display->key_bindings[i]; return &display->key_bindings[i];
@ -909,7 +907,6 @@ meta_display_get_keybinding_action (MetaDisplay *display,
unsigned long mask) unsigned long mask)
{ {
MetaKeyBinding *binding; MetaKeyBinding *binding;
KeySym keysym;
/* This is much more vague than the MetaDisplay::overlay-key signal, /* This is much more vague than the MetaDisplay::overlay-key signal,
* which is only emitted if the overlay-key is the only key pressed; * which is only emitted if the overlay-key is the only key pressed;
@ -920,12 +917,8 @@ meta_display_get_keybinding_action (MetaDisplay *display,
if (keycode == (unsigned int)display->overlay_key_combo.keycode) if (keycode == (unsigned int)display->overlay_key_combo.keycode)
return META_KEYBINDING_ACTION_OVERLAY_KEY; return META_KEYBINDING_ACTION_OVERLAY_KEY;
keysym = XKeycodeToKeysym (display->xdisplay, keycode, 0);
mask = mask & 0xff & ~display->ignored_modifier_mask; mask = mask & 0xff & ~display->ignored_modifier_mask;
binding = display_get_keybinding (display, keysym, keycode, mask); binding = display_get_keybinding (display, keycode, mask);
if (!binding && keycode == meta_display_get_above_tab_keycode (display))
binding = display_get_keybinding (display, META_KEY_ABOVE_TAB, keycode, mask);
if (binding) if (binding)
{ {
@ -1790,7 +1783,6 @@ process_overlay_key (MetaDisplay *display,
XIAsyncDevice, event->time); XIAsyncDevice, event->time);
binding = display_get_keybinding (display, binding = display_get_keybinding (display,
display->overlay_key_combo.keysym,
display->overlay_key_combo.keycode, display->overlay_key_combo.keycode,
display->grab_mask); display->grab_mask);
if (binding && if (binding &&