TLDR: If you see devices like "xwayland-pointer" show up in your xinput list output, then you are running under a Wayland compositor and debugging/configuration with xinput will not work.
For many years, the xinput tool has been a useful tool to debug configuration issues (it's not a configuration UI btw). It works by listing the various devices detected by the X server. So a typical output from xinput list under X could look like this:
:: whot@jelly:~> xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=22 [slave pointer (2)] ⎜ ↳ TPPS/2 IBM TrackPoint id=23 [slave pointer (2)] ⎜ ↳ ELAN Touchscreen id=20 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Lid Switch id=8 [slave keyboard (3)] ↳ Sleep Button id=9 [slave keyboard (3)] ↳ ThinkPad Extra Buttons id=24 [slave keyboard (3)]Alas, xinput is scheduled to go the way of the dodo. More and more systems are running a Wayland session instead of an X session, and xinput just doesn't work there. Here's an example output from xinput list under a Wayland session:
$ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ xwayland-pointer:13 id=6 [slave pointer (2)] ⎜ ↳ xwayland-relative-pointer:13 id=7 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ xwayland-keyboard:13 id=8 [slave keyboard (3)]As you can see, none of the physical devices are available, the only ones visible are the virtual devices created by XWayland. On a Wayland session, the X server doesn't have access to the physical devices. Instead, it talks via the Wayland protocol to the compositor. This image from the Wayland documentation shows the architecture:
This usually doesn't matter, but when it comes to debugging or configuring devices with xinput we run into a few issues. First, configuration via xinput usually means changing driver-specific properties but in the XWayland case there is no driver involved - it's all handled by libinput inside the compositor. Second, debugging via xinput only shows what the wayland protocol sends to XWayland and what XWayland then passes on to the client. For low-level issues with devices, this is all but useless.
The takeaway here is that if you see devices like "xwayland-pointer" show up in your xinput list output, then you are running under a Wayland compositor and debugging with xinput will not work. If you're trying to configure a device, use the compositor's configuration system (e.g. gsettings). If you are debugging a device, use libinput-debug-events. Or compare the behaviour between the Wayland session and the X session to narrow down where the failure point is.
Well, what about X apps that know how to work with separate input devices? Shouldn't it be possible for Wayland compositor to show as many virtual pointers/keyboards to X clients as it knows and simply route them by particular input interfaces?
ReplyDeleteI've recently written a game that uses many mice for input (one per player). This simple change would allow apps like that to still work via XWayland, so I wonder why wasn't it done and if it's some showstopper somewhere that I just don't see.
Wayland has the concept of seats for multiple devices. You won't see the physical devices (they're not exposed over the wayland protocol) but you can configure multiple seats and then use those. that should map in Xwayland to master devices and you're good to go.
ReplyDeleteYou helped me narrow my problem of the Wacom pen on my Dell Latitude 5285 not being registered in KDE Plasma/KWin on Wayland to libinput. Thank you!
ReplyDelete