Bug 5647 - keyboard grab doesn't work under Xwayland
Summary: keyboard grab doesn't work under Xwayland
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VNC (show other bugs)
Target Milestone: 4.12.0
Assignee: Samuel Mannehed
Keywords: relnotes, upstream
Depends on: 7373
Blocks: 5646
  Show dependency treegraph
Reported: 2015-09-22 15:59 CEST by Pierre Ossman
Modified: 2020-02-03 12:53 CET (History)
2 users (show)

See Also:
Acceptance Criteria:


Description Pierre Ossman cendio 2015-09-22 15:59:58 CEST
I tested running tlclient under Gnome and Wayland on my Fedora 22. Everything seems to work well, except for keyboard grab. I.e. things like alt-tab do not work properly in full screen.

This may be a general wayland problem though. See this part of the wayland documentation:


I doubt they can keep this model though as any remote access or virtualisation product requires keyboard grab at one point or another. We'll have to keep an eye on things and see how it develops.
Comment 1 Pierre Ossman cendio 2016-07-19 09:27:43 CEST
Upstream work:

Comment 2 Henrik Andersson cendio 2017-02-28 14:19:56 CET
Still a problem on Fedora 25, maybe we should try to detect and disable the "Send system keys" option when running client on Xwayland, at least add platform specific note.
Comment 3 Pierre Ossman cendio 2017-02-28 14:43:48 CET
It's not obvious how to detect wayland as I can notice that a wayland display socket is created even if I log in to a X11 session. However a connect to this socket fails.

The socket is available as ${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}

Perhaps we can detect Xwayland somehow?
Comment 4 Pierre Ossman cendio 2017-10-23 16:40:39 CEST
Mechanisms are getting finalised. However we need to do some window manager interaction. See this comment upstream:

Comment 6 Pierre Ossman cendio 2018-06-15 16:48:13 CEST
This now works on Fedora Rawhide (for upstream vncviewer). Note though that the function is disabled by default, and you have to muck around in dconf to enable it. :/
Comment 7 Pierre Ossman cendio 2019-06-18 16:23:16 CEST
The setting you need to change is "org.gnome.mutter.wayland.xwayland-allow-grabs". However upstream has now dropped that requirement from the upcoming version:


So it should mean that GNOME 3.34 is easier to get working.
Comment 8 Pierre Ossman cendio 2019-06-18 16:24:18 CEST
The version of GNOME supporting grabs in Wayland (3.28) has now also trickled out to distributions. Fedora has it, as does RHEL 7 and 8.
Comment 9 Pierre Ossman cendio 2019-06-18 16:34:38 CEST
Fixed the main part upstream, so we'll get this sorted out in the next vendor drop:


Unfortunately I discovered that upstream had forgotten about XGrabPointer(), so it still doesn't fully work:


It gets a lot better with that first fix though.
Comment 10 Pierre Ossman cendio 2019-06-25 15:30:16 CEST
Also note that it is possible to get grabs working without modifying the ThinLinc client by explicitly adding "thinlinc-client" to the dconf setting "org.gnome.mutter.wayland.xwayland-grab-access-rules".
Comment 11 Samuel Mannehed cendio 2020-01-31 14:24:02 CET
Verified that the problem exists when running the 4.11.0 client on Wayland.

Things work great for me with the new code, I can't even reproduce the XGrabPointer issue. Win+Right-click works well with "Send system keys" enabled in fullscreen.

$ gnome-shell --version
GNOME Shell 3.34.3
Comment 13 Pierre Ossman cendio 2020-02-03 12:53:04 CET
Release notes look good.

Note You need to log in before you can comment on or make changes to this bug.