GNOME Bugzilla – Bug 787016
Keybindings become layout sensitive
Last modified: 2017-09-25 19:35:51 UTC
Keybindings become layout sensitive. For example default keybinding for screen locking Super+L will work with latin layouts, but will do nothing with Cyrillic. Tested on Ubuntu 17.10, mutter 3.25.91.
Created attachment 358919 [details] [review] keybindings: Fix inconsistent struct field alignment
Created attachment 358920 [details] [review] keybindings: Keep a pointer to the backend A few less singleton getting.
Created attachment 358921 [details] [review] keybindings: Add support for resolving from multiple layouts Add the infrastructure to resolve keybinding symbols from multiple layouts. It is still unused, but will be, when the primary layout does not have the required latin keysyms in it.
Created attachment 358922 [details] [review] keybindings: Resolve on us layout too if primary is not latin based If a non-latin based keyboard layout is active, for example Cyrillic, keybindings won't work unless we resolve the bound keysyms on a secondary latin based layout. So, to make keybindings work on non-latin based layouts, detect if a keymap doesn't have all of the basic latin letters (a-z) and resolve from an additional US layout as well.
Created attachment 358923 [details] [review] keybindings: Resolve on us layout too if primary is not latin based If a non-latin based keyboard layout is active, for example Cyrillic, keybindings won't work unless we resolve the bound keysyms on a secondary latin based layout. So, to make keybindings work on non-latin based layouts, detect if a keymap doesn't have all of the basic latin letters (a-z) and resolve from an additional US layout as well.
Bug still present in final release.
Review of attachment 358919 [details] [review]: ok
Review of attachment 358920 [details] [review]: sure
Not a fan of introducing yet another layer of complexity and potentially an extra xkb keymap, etc. IMO, we could fix this bug with a small modification to get_keycodes_for_keysym() by iterating the current for() loop we have there with other layout indexes if the first iteration with the current layout index resulted in zero keycodes collected.
(In reply to Rui Matos from comment #9) > Not a fan of introducing yet another layer of complexity and potentially an > extra xkb keymap, etc. > > IMO, we could fix this bug with a small modification to > get_keycodes_for_keysym() by iterating the current for() loop we have there > with other layout indexes if the first iteration with the current layout > index resulted in zero keycodes collected. Can we rely on having an 'us' equivalent layout on one of the indices?
(In reply to Jonas Ådahl from comment #10) > Can we rely on having an 'us' equivalent layout on one of the indices? I thought we did, in gnome-shell, but what we do is guarantee that there's always a layout for the displayed language so that mnemonics like Alt+Ф work even if only a latin layout is configured. That's a different issue though and it only works for sophisticated clients, like gtk+. Anyway, I guess this is a good solution for the bug presented here, even though having only a non-latin layout configured doesn't seem like a common case.
Review of attachment 358921 [details] [review]: ok
Review of attachment 358923 [details] [review]: I'd still prefer to load the 'us' layout only if we don't find keycodes for a binding after looking in all indexes, but not a big deal and this is already written and works so
(In reply to Rui Matos from comment #13) > Review of attachment 358923 [details] [review] [review]: > > I'd still prefer to load the 'us' layout only if we don't find keycodes for > a binding after looking in all indexes, but not a big deal and this is > already written and works so I went with the already implemented way, simply because it's less work than changing to do it ad-hoc :P Attachment 358919 [details] pushed as 0e62b71 - keybindings: Fix inconsistent struct field alignment Attachment 358920 [details] pushed as 27d6c06 - keybindings: Keep a pointer to the backend Attachment 358921 [details] pushed as 8b06034 - keybindings: Add support for resolving from multiple layouts Attachment 358923 [details] pushed as 487b8a0 - keybindings: Resolve on us layout too if primary is not latin based