forked from mirror/dwl
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
This commit is contained in:
parent
3cc22de712
commit
8bd3442575
1 changed files with 10 additions and 9 deletions
19
dwl.c
19
dwl.c
|
@ -152,6 +152,7 @@ typedef struct {
|
||||||
struct wlr_box geom;
|
struct wlr_box geom;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
struct wlr_scene_node *scene;
|
struct wlr_scene_node *scene;
|
||||||
|
struct wlr_scene_node *popups;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
int mapped;
|
int mapped;
|
||||||
struct wlr_layer_surface_v1 *layer_surface;
|
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.top, state->margin.right,
|
||||||
state->margin.bottom, state->margin.left);
|
state->margin.bottom, state->margin.left);
|
||||||
wlr_scene_node_set_position(layersurface->scene, box.x, box.y);
|
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);
|
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) {
|
if (layers[wlr_layer_surface->current.layer] != layersurface->scene->parent) {
|
||||||
wlr_scene_node_reparent(layersurface->scene,
|
wlr_scene_node_reparent(layersurface->scene,
|
||||||
layers[wlr_layer_surface->current.layer]);
|
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_remove(&layersurface->link);
|
||||||
wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer],
|
wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer],
|
||||||
&layersurface->link);
|
&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
|
if (wlr_layer_surface->current.committed == 0
|
||||||
&& layersurface->mapped == wlr_layer_surface->mapped)
|
&& layersurface->mapped == wlr_layer_surface->mapped)
|
||||||
|
@ -920,10 +926,11 @@ createlayersurface(struct wl_listener *listener, void *data)
|
||||||
layersurface->mon = wlr_layer_surface->output->data;
|
layersurface->mon = wlr_layer_surface->output->data;
|
||||||
wlr_layer_surface->data = layersurface;
|
wlr_layer_surface->data = layersurface;
|
||||||
|
|
||||||
layersurface->scene = wlr_layer_surface->surface->data =
|
layersurface->scene = wlr_scene_subsurface_tree_create(
|
||||||
wlr_scene_subsurface_tree_create(layers[wlr_layer_surface->pending.layer],
|
layers[wlr_layer_surface->pending.layer], wlr_layer_surface->surface);
|
||||||
wlr_layer_surface->surface);
|
|
||||||
layersurface->scene->data = layersurface;
|
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],
|
wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->pending.layer],
|
||||||
&layersurface->link);
|
&layersurface->link);
|
||||||
|
@ -1011,12 +1018,6 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
LayerSurface *l = toplevel_from_popup(xdg_surface->popup);
|
LayerSurface *l = toplevel_from_popup(xdg_surface->popup);
|
||||||
xdg_surface->surface->data = wlr_scene_xdg_surface_create(
|
xdg_surface->surface->data = wlr_scene_xdg_surface_create(
|
||||||
xdg_surface->popup->parent->data, xdg_surface);
|
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
|
/* Probably the check of `l` is useless, the only thing that can be NULL
|
||||||
* is its monitor */
|
* is its monitor */
|
||||||
if (!l || !l->mon)
|
if (!l || !l->mon)
|
||||||
|
|
Loading…
Reference in a new issue