xwm: ensure stack list only contains mapped managed surfaces

master
novenary 2 years ago committed by Kirill Primak
parent 720e8ac26b
commit f1762f428b

@ -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,

Loading…
Cancel
Save