Merged requested to merge ofourdan/xserver:xwayland-no-server-grab into master
Because of the design of most Wayland compositors, where the compositor is both a Wayland server and an X11 window manager, any X11 client issuing a server grab (i.e. XGrabServer()) can possibly hang the whole desktop when Xwayland is running rootless.
This can happen with e.g. ImageMagick's import command with mutter.
- "import" is launched and issues an XServerGrab(),
- Xwayland restricts access to that "import" X11 client alone,
- mutter continues to process events until it needs to sync with Xwayland (there's variability in time before the hang occurs),
- When mutter does an XSync() (explicitly or implicitly through some other Xlib call), it will stop waiting for Xwayland to reply,
- Xwayland waits for the XServerGrab() to be released by import,
- "import" waits for a user input to release the XServerGrab(),
- mutter is stuck waiting on Xwayland and does not process input events...
To prevent this, re-route the GrabServer/UngrabServer requests and pretend the grab works but actually does nothing at all for all clients but the X11 window manager (which can still issue X11 server grabs, at its own risks).
Signed-off-by: Olivier Fourdan firstname.lastname@example.org