diff options
author | Leonardo Hernández Hernández <leohdz172@protonmail.com> | 2022-10-31 20:42:17 -0600 |
---|---|---|
committer | Leonardo Hernández Hernández <leohdz172@protonmail.com> | 2022-11-01 12:52:25 -0600 |
commit | 8bd344257501b9293126348bf956beb8c9ddcfae (patch) | |
tree | f9d5998828fd01508d437a0df8ace7f3e9258967 | |
parent | 3cc22de712415342e4865eef099fcfde49bcf734 (diff) |
layersurface: create a dedicated scene tree for popups
this tree should be always above the top layer
Fixes: https://github.com/djpohly/dwl/issues/328
-rw-r--r-- | dwl.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -152,6 +152,7 @@ typedef struct { struct wlr_box geom; Monitor *mon; struct wlr_scene_node *scene; + struct wlr_scene_node *popups; struct wl_list link; int mapped; struct wlr_layer_surface_v1 *layer_surface; @@ -583,6 +584,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int state->margin.top, state->margin.right, state->margin.bottom, state->margin.left); wlr_scene_node_set_position(layersurface->scene, box.x, box.y); + wlr_scene_node_set_position(layersurface->popups, box.x, box.y); wlr_layer_surface_v1_configure(wlr_layer_surface, box.width, box.height); } } @@ -823,10 +825,14 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data) if (layers[wlr_layer_surface->current.layer] != layersurface->scene->parent) { wlr_scene_node_reparent(layersurface->scene, layers[wlr_layer_surface->current.layer]); + wlr_scene_node_reparent(layersurface->popups, + layers[wlr_layer_surface->current.layer]); wl_list_remove(&layersurface->link); wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer], &layersurface->link); } + if (wlr_layer_surface->current.layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) + wlr_scene_node_reparent(layersurface->popups, layers[LyrTop]); if (wlr_layer_surface->current.committed == 0 && layersurface->mapped == wlr_layer_surface->mapped) @@ -920,10 +926,11 @@ createlayersurface(struct wl_listener *listener, void *data) layersurface->mon = wlr_layer_surface->output->data; wlr_layer_surface->data = layersurface; - layersurface->scene = wlr_layer_surface->surface->data = - wlr_scene_subsurface_tree_create(layers[wlr_layer_surface->pending.layer], - wlr_layer_surface->surface); + layersurface->scene = wlr_scene_subsurface_tree_create( + layers[wlr_layer_surface->pending.layer], wlr_layer_surface->surface); layersurface->scene->data = layersurface; + layersurface->popups = wlr_layer_surface->surface->data = + &wlr_scene_tree_create(layers[wlr_layer_surface->pending.layer])->node; wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->pending.layer], &layersurface->link); @@ -1011,12 +1018,6 @@ createnotify(struct wl_listener *listener, void *data) LayerSurface *l = toplevel_from_popup(xdg_surface->popup); xdg_surface->surface->data = wlr_scene_xdg_surface_create( xdg_surface->popup->parent->data, xdg_surface); - /* Raise to top layer if the inmediate parent of the popup is on - * bottom/background layer, which will cause popups appear below the - * x{dg,wayland} clients */ - if (wlr_surface_is_layer_surface(xdg_surface->popup->parent) && l - && l->layer_surface->current.layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) - wlr_scene_node_reparent(xdg_surface->surface->data, layers[LyrTop]); /* Probably the check of `l` is useless, the only thing that can be NULL * is its monitor */ if (!l || !l->mon) |