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
This commit is contained in:
Kirill Primak 2023-11-26 02:49:56 +03:00
parent 4990ed99eb
commit c3c7b1c9d0

View file

@ -1122,8 +1122,6 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm,
return; 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); 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); 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, static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,