Skip to content

xwayland: Prevent Xserver grabs with rootless

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.

  1. "import" is launched and issues an XServerGrab(),
  2. Xwayland restricts access to that "import" X11 client alone,
  3. mutter continues to process events until it needs to sync with Xwayland (there's variability in time before the hang occurs),
  4. When mutter does an XSync() (explicitly or implicitly through some other Xlib call), it will stop waiting for Xwayland to reply,
  5. Xwayland waits for the XServerGrab() to be released by import,
  6. "import" waits for a user input to release the XServerGrab(),
  7. 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 ofourdan@redhat.com
Closes: https://bugzilla.redhat.com/1914021

Edited by Olivier Fourdan

Merge request reports