mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
layers: put popups in separate node-tree
This allows popups to be rendered above views and other layers. Without this, the popups of a layer-shell application in the bottom layer would render below views, which does not seem right. For example, consider the case of a panel with right-click popups.
This commit is contained in:
parent
34bd1fb6da
commit
6fd400b493
3 changed files with 36 additions and 7 deletions
25
src/layers.c
25
src/layers.c
|
|
@ -247,12 +247,6 @@ create_popup(struct wlr_xdg_popup *wlr_popup, struct wlr_scene_node *parent)
|
|||
popup->new_popup.notify = popup_handle_new_popup;
|
||||
wl_signal_add(&wlr_popup->base->events.new_popup, &popup->new_popup);
|
||||
|
||||
/*
|
||||
* FIXME: should we put popups in ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY
|
||||
* or a dedicated output->layer_popup_tree - so that for example
|
||||
* a panel in the bottom layer displays any popup above views.
|
||||
*/
|
||||
|
||||
popup_unconstrain(popup);
|
||||
return popup;
|
||||
}
|
||||
|
|
@ -272,7 +266,24 @@ new_popup_notify(struct wl_listener *listener, void *data)
|
|||
struct lab_layer_surface *lab_layer_surface =
|
||||
wl_container_of(listener, lab_layer_surface, new_popup);
|
||||
struct wlr_xdg_popup *wlr_popup = data;
|
||||
create_popup(wlr_popup, lab_layer_surface->scene_layer_surface->node);
|
||||
|
||||
/*
|
||||
* We always put popups in a special popup_tree so that for example a
|
||||
* panel in the bottom layer displays popups above views.
|
||||
*/
|
||||
struct server *server = lab_layer_surface->server;
|
||||
struct wlr_output *wlr_output =
|
||||
lab_layer_surface->scene_layer_surface->layer_surface->output;
|
||||
struct output *output = output_from_wlr_output(server, wlr_output);
|
||||
struct wlr_scene_node *node = &output->layer_popup_tree->node;
|
||||
|
||||
create_popup(wlr_popup, node);
|
||||
|
||||
struct wlr_box box = { 0 };
|
||||
wlr_output_layout_get_box(server->output_layout, wlr_output, &box);
|
||||
box.x += lab_layer_surface->scene_layer_surface->node->state.x;
|
||||
box.y += lab_layer_surface->scene_layer_surface->node->state.y;
|
||||
wlr_scene_node_set_position(node, box.x, box.y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue