On Thu Apr 9 11:14:26 2026 +0000, Matteo Bruni wrote:
It looks like I don't get any MappingNotify events already with upstream Wine. That's on both pure X11 and Xwayland. Thinking back to it, it was probably the other way around: I saw no MappingNotify event, interpreted that Xkblib doc excerpt as "if you explicitly use Xkb you don't get MappingNotify events" and proceeded to enable and handle the Xkb events instead. I'm not sure what broke this and how far back it goes. For what it's worth, Xkb events seem to work pretty okay in the setups I checked and we could always add more failsafes if necessary (e.g. in your draft MR you update the current Xkb group from `KeyEvent`, https://gitlab.winehq.org/wine/wine/-/merge_requests/2122/diffs?commit_id=8c...) I do see MappingNotify events, both on GNOME (Wayland) and KDE (X11 and Wayland). There are some variations between their behavior, some for instance reconfigure the keyboard every time the input method is changed, some only reconfigure the layout when switching between groups of 4-layouts. There are MappingNotify events when configuring the input methods as well.
There is some weird thing going on GNOME Wayland that we might need to figure out (or we'll have to delay layout detection), and it is that I only see MappingNotify events *after* a KeyEvent has been received, which means that if no key is pressed and the layout is switched to a different set of 4 layout groups (this is how GNOME manages the layouts), we might incorrectly use the layouts that were initialized on startup. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10550#note_135658