From c3c7b1c9d01ed876144fdf9210aba8d1ad38b332 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sun, 26 Nov 2023 02:49:56 +0300 Subject: xwm: don't do anything except mapping on MapRequest Instead, move the wlr_xwayland_surface_set_withdrawn() and wlr_xwayland_surface_restack() calls to the MapNotify handler with an override_redirect check, as they are done too early. This mirrors the logic in the UnmapNotify handler and fixes a bug where wlr_xwayland_surface_restack() would be called on an o-r window after the following sequence of requests: - CreateWindow with override_redirect=True - ChangeWindowAttributes with override_redirect=False - MapWindow Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3770 --- xwayland/xwm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xwayland') diff --git a/xwayland/xwm.c b/xwayland/xwm.c index e744565a..88b2fe56 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1122,8 +1122,6 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm, return; } - wlr_xwayland_surface_set_withdrawn(xsurface, false); - wlr_xwayland_surface_restack(xsurface, NULL, XCB_STACK_MODE_BELOW); xcb_map_window(xwm->xcb_conn, ev->window); } @@ -1135,6 +1133,11 @@ static void xwm_handle_map_notify(struct wlr_xwm *xwm, } xwm_update_override_redirect(xsurface, ev->override_redirect); + + if (!xsurface->override_redirect) { + wlr_xwayland_surface_set_withdrawn(xsurface, false); + wlr_xwayland_surface_restack(xsurface, NULL, XCB_STACK_MODE_BELOW); + } } static void xwm_handle_unmap_notify(struct wlr_xwm *xwm, -- cgit v1.2.3