mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
xwyland/xwm: simplify unpaired_link handling
Always keep it initialized, so that we don't have to check for xsurface->surface_id. Will help with WL_SURFACE_SERIAL support, which adds a new way for a surface to be unpaired.
This commit is contained in:
parent
c6d8a11d2c
commit
2ee59e1a08
1 changed files with 13 additions and 12 deletions
|
@ -159,6 +159,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
|
||||||
wl_list_init(&surface->children);
|
wl_list_init(&surface->children);
|
||||||
wl_list_init(&surface->stack_link);
|
wl_list_init(&surface->stack_link);
|
||||||
wl_list_init(&surface->parent_link);
|
wl_list_init(&surface->parent_link);
|
||||||
|
wl_list_init(&surface->unpaired_link);
|
||||||
wl_signal_init(&surface->events.destroy);
|
wl_signal_init(&surface->events.destroy);
|
||||||
wl_signal_init(&surface->events.request_configure);
|
wl_signal_init(&surface->events.request_configure);
|
||||||
wl_signal_init(&surface->events.request_move);
|
wl_signal_init(&surface->events.request_move);
|
||||||
|
@ -406,9 +407,7 @@ static void xwayland_surface_destroy(
|
||||||
child->parent = NULL;
|
child->parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xsurface->surface_id) {
|
wl_list_remove(&xsurface->unpaired_link);
|
||||||
wl_list_remove(&xsurface->unpaired_link);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xsurface->surface) {
|
if (xsurface->surface) {
|
||||||
wl_list_remove(&xsurface->surface_destroy.link);
|
wl_list_remove(&xsurface->surface_destroy.link);
|
||||||
|
@ -879,6 +878,10 @@ static void xwm_map_shell_surface(struct wlr_xwm *xwm,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_list_remove(&xsurface->unpaired_link);
|
||||||
|
wl_list_init(&xsurface->unpaired_link);
|
||||||
|
xsurface->surface_id = 0;
|
||||||
|
|
||||||
xsurface->surface = surface;
|
xsurface->surface = surface;
|
||||||
|
|
||||||
// read all surface properties
|
// read all surface properties
|
||||||
|
@ -913,13 +916,12 @@ static void xsurface_unmap(struct wlr_xwayland_surface *surface) {
|
||||||
xwm_set_net_client_list(surface->xwm);
|
xwm_set_net_client_list(surface->xwm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->surface_id) {
|
// Make sure we're not on the unpaired surface list or we
|
||||||
// Make sure we're not on the unpaired surface list or we
|
// could be assigned a surface during surface creation that
|
||||||
// could be assigned a surface during surface creation that
|
// was mapped before this unmap request.
|
||||||
// was mapped before this unmap request.
|
wl_list_remove(&surface->unpaired_link);
|
||||||
wl_list_remove(&surface->unpaired_link);
|
wl_list_init(&surface->unpaired_link);
|
||||||
surface->surface_id = 0;
|
surface->surface_id = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (surface->surface) {
|
if (surface->surface) {
|
||||||
wl_list_remove(&surface->surface_destroy.link);
|
wl_list_remove(&surface->surface_destroy.link);
|
||||||
|
@ -1129,6 +1131,7 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm,
|
||||||
xwm_map_shell_surface(xwm, xsurface, surface);
|
xwm_map_shell_surface(xwm, xsurface, surface);
|
||||||
} else {
|
} else {
|
||||||
xsurface->surface_id = id;
|
xsurface->surface_id = id;
|
||||||
|
wl_list_remove(&xsurface->unpaired_link);
|
||||||
wl_list_insert(&xwm->unpaired_surfaces, &xsurface->unpaired_link);
|
wl_list_insert(&xwm->unpaired_surfaces, &xsurface->unpaired_link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1655,8 +1658,6 @@ static void handle_compositor_new_surface(struct wl_listener *listener,
|
||||||
wl_list_for_each(xsurface, &xwm->unpaired_surfaces, unpaired_link) {
|
wl_list_for_each(xsurface, &xwm->unpaired_surfaces, unpaired_link) {
|
||||||
if (xsurface->surface_id == surface_id) {
|
if (xsurface->surface_id == surface_id) {
|
||||||
xwm_map_shell_surface(xwm, xsurface, surface);
|
xwm_map_shell_surface(xwm, xsurface, surface);
|
||||||
xsurface->surface_id = 0;
|
|
||||||
wl_list_remove(&xsurface->unpaired_link);
|
|
||||||
xcb_flush(xwm->xcb_conn);
|
xcb_flush(xwm->xcb_conn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue