After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787016 - Keybindings become layout sensitive
Keybindings become layout sensitive
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.25.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2017-08-30 14:35 UTC by Anton Sudak
Modified: 2017-09-25 19:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
keybindings: Fix inconsistent struct field alignment (874 bytes, patch)
2017-09-01 10:46 UTC, Jonas Ådahl
committed Details | Review
keybindings: Keep a pointer to the backend (3.55 KB, patch)
2017-09-01 10:46 UTC, Jonas Ådahl
committed Details | Review
keybindings: Add support for resolving from multiple layouts (7.70 KB, patch)
2017-09-01 10:46 UTC, Jonas Ådahl
committed Details | Review
keybindings: Resolve on us layout too if primary is not latin based (5.58 KB, patch)
2017-09-01 10:46 UTC, Jonas Ådahl
none Details | Review
keybindings: Resolve on us layout too if primary is not latin based (5.58 KB, patch)
2017-09-01 10:48 UTC, Jonas Ådahl
committed Details | Review

Description Anton Sudak 2017-08-30 14:35:37 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.
Comment 1 Jonas Ådahl 2017-09-01 10:46:33 UTC
Created attachment 358919 [details] [review]
keybindings: Fix inconsistent struct field alignment
Comment 2 Jonas Ådahl 2017-09-01 10:46:39 UTC
Created attachment 358920 [details] [review]
keybindings: Keep a pointer to the backend

A few less singleton getting.
Comment 3 Jonas Ådahl 2017-09-01 10:46:44 UTC
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.
Comment 4 Jonas Ådahl 2017-09-01 10:46:50 UTC
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.
Comment 5 Jonas Ådahl 2017-09-01 10:48:31 UTC
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.
Comment 6 Anton Sudak 2017-09-20 10:43:02 UTC
Bug still present in final release.
Comment 7 Rui Matos 2017-09-20 14:14:37 UTC
Review of attachment 358919 [details] [review]:

ok
Comment 8 Rui Matos 2017-09-20 14:14:44 UTC
Review of attachment 358920 [details] [review]:

sure
Comment 9 Rui Matos 2017-09-20 14:19:38 UTC
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.
Comment 10 Jonas Ådahl 2017-09-25 13:19:03 UTC
(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?
Comment 11 Rui Matos 2017-09-25 14:41:26 UTC
(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.
Comment 12 Rui Matos 2017-09-25 14:41:44 UTC
Review of attachment 358921 [details] [review]:

ok
Comment 13 Rui Matos 2017-09-25 14:44:53 UTC
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
Comment 14 Jonas Ådahl 2017-09-25 19:35:40 UTC
(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