From 00530769f7a968447b75e8375a503a6f6fcc1e7e Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 21 Feb 2022 10:20:09 +0100 Subject: [PATCH] Xwayland: Do not map the COW by default when rootless MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The composite overlay window (COW) can be queried from any X11 client, not just the X11 compositing manager. If a client tries to get the composite overlay window, the Xserver will map the window and block all pointer events (the window being mapped and on top of the stack). To avoid that issue, unset the "mapped" state of the composite overlay window once realized when Xwayland is running rootless. Note: All Xservers are actually affected by this issue, but with most regular X servers, the compositing manager will take care of dealing with the composite overlay window, and an X11 client using GetOverlayWindow() won't break pointer events for all X11 clients. Wayland compositors however usually run Xwayland rootless and have no use for the COW. v2: Avoid registering damage for the COW (Michel) v3: Remove the "mapped" test to avoid calling register_damage() if the COW is not mapped (Michel) Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1314 Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer (cherry picked from commit 47d33174646a6397284f3483f9102608f5508454) --- hw/xwayland/xwayland-window.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 00f161eda..152b4d0a6 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -522,6 +522,7 @@ Bool xwl_realize_window(WindowPtr window) { ScreenPtr screen = window->drawable.pScreen; + CompScreenPtr comp_screen = GetCompScreen(screen); struct xwl_screen *xwl_screen; Bool ret; @@ -535,12 +536,20 @@ xwl_realize_window(WindowPtr window) if (!ret) return FALSE; - if (xwl_screen->rootless && !window->parent) { - BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height }; + if (xwl_screen->rootless) { + /* We do not want the COW to be mapped when rootless in Xwayland */ + if (window == comp_screen->pOverlayWin) { + window->mapped = FALSE; + return TRUE; + } - RegionReset(&window->winSize, &box); - RegionNull(&window->clipList); - RegionNull(&window->borderClip); + if (!window->parent) { + BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height }; + + RegionReset(&window->winSize, &box); + RegionNull(&window->clipList); + RegionNull(&window->borderClip); + } } if (xwl_screen->rootless ?