Bug 93237 - Spontaneous keyboard layout switching after upgrade to XWayland 1.18.0
Summary: Spontaneous keyboard layout switching after upgrade to XWayland 1.18.0
Status: RESOLVED MOVED
Alias: None
Product: Wayland
Classification: Unclassified
Component: XWayland (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Wayland bug list
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-04 04:25 UTC by Simon Volpert
Modified: 2019-05-10 15:52 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Simon Volpert 2015-12-04 04:25:50 UTC
I have the following setxkbmap options set:

layout=us,ru,il
options=grp:caps_toggle,shift:both_shiftlock,compose:ralt

After the upgrade to XWayland 1.18.0, switching the layout once causes it to reset to the last configured layout (il) every time a modifier key (any of ALT, CTRL, SHIFT or SUPER) is pressed. The layout also resets to the last layout after a new window gains focus.

It is interesting to note that those options are not exposed in setxkbmap's "setxkbmap -print -v 10" in 1.17.4, but are in 1.18.0.

System: Arch Linux
Kernel: 4.2.5-1-ARCH
Comment 1 Daniel Stone 2015-12-04 08:54:55 UTC
Are you setting those options with the setxkbmap tool? If so, that is not supported, and please set those options through your compositor (e.g. GNOME Tweak Tool or weston.ini).
Comment 2 Simon Volpert 2015-12-04 11:27:02 UTC
No, i am setting these options using the method, recommended by the WM (weston.ini for Weston; XKB_* variables for Orbment). The setxkbmap tool was used in an attempt to narrow the problem down to the component responsible.
Comment 3 Christian Stadelmann 2016-07-21 15:21:30 UTC
I'm probably affected by this too. I am not using setxkbmap, but gnome-control-center.

$ localectl
   System Locale: LANG=de_DE.UTF-8
       VC Keymap: de-neo
      X11 Layout: de,de
     X11 Variant: neo,nodeadkeys
     X11 Options: grp:sclk_toggle
Comment 4 Jonas Ådahl 2016-07-21 15:32:49 UTC
I also have been affected by something similar to this I think.

Though, what I've experienced is that the layout is switched back us-dvorak-alt-intl from svdvorak after entering one character. For example what I have seen has been:

1. Switch to svdvorak
 * switched to svdvorak *
2. Press å
 * å is entered *
 * silently switched to us-dvorak-alt-intl in xwayland *
3. Switch to svdvorak
 * switched to svdvorak *
4. Press ¨ (dead key)
5. Press o
 * ö is entered *
 * silently switched to us-dvorak-alt-intl in xwayland * (or after 4., I don't know, o is in the same place)

Settings and switching has been done using GNOME. I don't know how to reproduce this reliably, and it doesn't happen that often. IIRC sometimes I haven't even been able to switch to svdvorak for entering one letter.

$ localectl
   System Locale: LANG=en_US.UTF-8
                  LC_NUMERIC=en_DK.utf8
                  LC_TIME=en_DK.utf8
                  LC_MONETARY=en_DK.utf8
                  LC_PAPER=en_DK.utf8
                  LC_MEASUREMENT=en_DK.utf8
       VC Keymap: us-dvorak-alt-intl
      X11 Layout: us,se
     X11 Variant: dvorak-alt-intl,svdvorak
Comment 5 Jonas Ådahl 2017-01-23 03:37:03 UTC
So I found out what caused the issues on my end, but I cannot verify it is what is causing issues for others.

So in my case, as described in comment 4, the layout switch was only valid for one key. After some digging, the reason was a bag X11 client; in my case a nested mutter instance (i.e. running mutter as a nested Wayland compositor on top of X11) trying to have a say in the XkbState. Mutter normally does this, being the window manager, but when running nested, it's not a good idea to mess with the host X11 servers xkb state.

So, if anyone still is hitting this, this is a way to find out what client is screwing up the state (assuming its the same type of issue).

 1. Set the keyboard layout you want and focus an X11 client
 2. From another computer, attach gdb to the Xwayland process
 3. Add a break point on the 'event_get_corestate' function
 4. Press some key to trigger some X11 key event
 5. When the breakpoint hits, add a hardware watch point on the value the '&kbd->key->xkbInfo->state.locked_group' pointer points at (e.g. "watch *(unsigned char *)0x123456" where the above pointer is 0x123456.)
 6. Disable the breakpoint on 'event_get_corestate'.
 7. Continue gdb
 8. Reproduce the issue
 9. Check that gdb have stopped, hopefully in ProcXkbLatchLockState()
10. Inspect the client mask: printf "0x%x\n", client->clientAsMask
11. Look up what client it is by comparing the mask with the windows listed by xwininfo -root -tree. For example if the client mask above was 0x1600000, try "xwininfo -root -tree | grep 0x16".

Note, there might be a better way to intercept and examine client protocol traffic that I don't know about. The key point is to find what client tries to mess with the xkb state.
Comment 6 Daniel Stone 2018-06-04 07:31:11 UTC
Simon, is Jonas's comment helpful for you at all?
Comment 7 Simon Volpert 2018-06-04 15:39:39 UTC
(In reply to Daniel Stone from comment #6)
> Simon, is Jonas's comment helpful for you at all?

To be honest, not very much. Firstly, the described process is too complicated for me to reproduce. Secondly, the general context of the bug i was experiencing was different; I was using a typical set of programs (Firefox, weston-terminal, LibreOffice) under the Weston compositor, so no weird window manager nesting for me. Thirdly, i have since given up on Wayland, for now, and switched back to X.Org, in an attempt to work around its problems and get some useful stuff done.

Sorry!
Comment 8 aappddeevv 2018-06-06 17:24:58 UTC
I'm not sure what caused it for me, but I'm on XWayland 1.19 (fc28) and upon a reboot the keyboard was switched to us basic vs us dvorak (which is what I want). My underlying keymap is based on dvorak for the virtual console. tilex still used dvorak as I think that's a pure wayland app now. This has never happened before.
Comment 9 Christian Stadelmann 2018-06-06 20:01:21 UTC
I cannot remember having this issue seen in a very long time, probably over a year.

(In reply to aappddeevv from comment #8)
> I'm not sure what caused it for me, but I'm on XWayland 1.19 (fc28) and upon
> a reboot the keyboard was switched to us basic vs us dvorak (which is what I
> want). My underlying keymap is based on dvorak for the virtual console.
> tilex still used dvorak as I think that's a pure wayland app now. This has
> never happened before.

In case you also updated xkeyboard-config to 2.24 (landed in updates-testing <40 hours ago), you might be running into this bug https://bugzilla.redhat.com/show_bug.cgi?id=1587998 instead.
Comment 10 GitLab Migration User 2019-05-10 15:52:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/696.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.