aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornovenary <streetwalkermc@gmail.com>2023-03-10 15:05:41 +0200
committerKirill Primak <vyivel@eclair.cafe>2023-11-23 10:41:41 +0000
commitf1762f428b0ef2989c81f57ea9e810403d34d946 (patch)
tree3166a279bbabac272c85b245b05306550afacb66
parent720e8ac26b2750a7183ef64011e195460775a60d (diff)
xwm: ensure stack list only contains mapped managed surfaces
-rw-r--r--xwayland/xwm.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 47679284..e744565a 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -411,6 +411,10 @@ static void xwayland_surface_dissociate(struct wlr_xwayland_surface *xsurface) {
wl_list_init(&xsurface->unpaired_link);
xsurface->surface_id = 0;
xsurface->serial = 0;
+
+ wl_list_remove(&xsurface->stack_link);
+ wl_list_init(&xsurface->stack_link);
+ xwm_set_net_client_list_stacking(xsurface->xwm);
}
static void xwayland_surface_destroy(struct wlr_xwayland_surface *xsurface) {
@@ -423,7 +427,6 @@ static void xwayland_surface_destroy(struct wlr_xwayland_surface *xsurface) {
}
wl_list_remove(&xsurface->link);
- wl_list_remove(&xsurface->stack_link);
wl_list_remove(&xsurface->parent_link);
struct wlr_xwayland_surface *child, *next;
@@ -999,6 +1002,24 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
wl_signal_emit_mutable(&surface->events.request_configure, &wlr_event);
}
+static void xwm_update_override_redirect(struct wlr_xwayland_surface *xsurface,
+ bool override_redirect) {
+ if (xsurface->override_redirect == override_redirect) {
+ return;
+ }
+ xsurface->override_redirect = override_redirect;
+
+ if (override_redirect) {
+ wl_list_remove(&xsurface->stack_link);
+ wl_list_init(&xsurface->stack_link);
+ xwm_set_net_client_list_stacking(xsurface->xwm);
+ } else if (xsurface->surface != NULL && xsurface->surface->mapped) {
+ wlr_xwayland_surface_restack(xsurface, NULL, XCB_STACK_MODE_BELOW);
+ }
+
+ wl_signal_emit_mutable(&xsurface->events.set_override_redirect, NULL);
+}
+
static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
xcb_configure_notify_event_t *ev) {
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
@@ -1017,10 +1038,7 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
xsurface->height = ev->height;
}
- if (xsurface->override_redirect != ev->override_redirect) {
- xsurface->override_redirect = ev->override_redirect;
- wl_signal_emit_mutable(&xsurface->events.set_override_redirect, NULL);
- }
+ xwm_update_override_redirect(xsurface, ev->override_redirect);
if (geometry_changed) {
wl_signal_emit_mutable(&xsurface->events.set_geometry, NULL);
@@ -1116,10 +1134,7 @@ static void xwm_handle_map_notify(struct wlr_xwm *xwm,
return;
}
- if (xsurface->override_redirect != ev->override_redirect) {
- xsurface->override_redirect = ev->override_redirect;
- wl_signal_emit_mutable(&xsurface->events.set_override_redirect, NULL);
- }
+ xwm_update_override_redirect(xsurface, ev->override_redirect);
}
static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,