aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <alex@ozal.ski>2024-01-23 10:17:26 -0500
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2024-02-12 19:19:22 +0300
commit1846944f0454fec08ad91a04ab04e3b1ffcd1764 (patch)
tree76b6cea3f679e8eff228001654fa43a6a9aa8f47 /sway
parentlayer_shell: Arrange popups even if exclusive zone doesn't change (diff)
downloadsway-1846944f0454fec08ad91a04ab04e3b1ffcd1764.tar.gz
sway-1846944f0454fec08ad91a04ab04e3b1ffcd1764.tar.zst
sway-1846944f0454fec08ad91a04ab04e3b1ffcd1764.zip
xdg_shell: Extract struct for popup descriptor
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/transaction.c8
-rw-r--r--sway/desktop/xdg_shell.c5
-rw-r--r--sway/input/cursor.c2
3 files changed, 8 insertions, 7 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index c1a988ca..e3196e3a 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -609,17 +609,15 @@ static void arrange_output(struct sway_output *output, int width, int height) {
609void arrange_popups(struct wlr_scene_tree *popups) { 609void arrange_popups(struct wlr_scene_tree *popups) {
610 struct wlr_scene_node *node; 610 struct wlr_scene_node *node;
611 wl_list_for_each(node, &popups->children, link) { 611 wl_list_for_each(node, &popups->children, link) {
612 struct sway_xdg_popup *popup = scene_descriptor_try_get(node, 612 struct sway_popup_desc *popup = scene_descriptor_try_get(node,
613 SWAY_SCENE_DESC_POPUP); 613 SWAY_SCENE_DESC_POPUP);
614 614
615 // the popup layer may have popups from layer_shell surfaces, in this 615 // the popup layer may have popups from layer_shell surfaces, in this
616 // case those don't have a scene descriptor, so lets skip those here. 616 // case those don't have a scene descriptor, so lets skip those here.
617 if (popup) { 617 if (popup) {
618 struct wlr_scene_tree *tree = popup->view->content_tree;
619
620 int lx, ly; 618 int lx, ly;
621 wlr_scene_node_coords(&tree->node, &lx, &ly); 619 wlr_scene_node_coords(popup->relative, &lx, &ly);
622 wlr_scene_node_set_position(&popup->scene_tree->node, lx, ly); 620 wlr_scene_node_set_position(node, lx, ly);
623 } 621 }
624 } 622 }
625} 623}
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index d3f69a15..f4a25cf4 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -97,8 +97,11 @@ static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup,
97 return NULL; 97 return NULL;
98 } 98 }
99 99
100 popup->desc.relative = &view->content_tree->node;
101 popup->desc.view = view;
102
100 if (!scene_descriptor_assign(&popup->scene_tree->node, 103 if (!scene_descriptor_assign(&popup->scene_tree->node,
101 SWAY_SCENE_DESC_POPUP, popup)) { 104 SWAY_SCENE_DESC_POPUP, &popup->desc)) {
102 sway_log(SWAY_ERROR, "Failed to allocate a popup scene descriptor"); 105 sway_log(SWAY_ERROR, "Failed to allocate a popup scene descriptor");
103 wlr_scene_node_destroy(&popup->scene_tree->node); 106 wlr_scene_node_destroy(&popup->scene_tree->node);
104 free(popup); 107 free(popup);
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 404c1eed..f25439cb 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -90,7 +90,7 @@ struct sway_node *node_at_coords(
90 } 90 }
91 91
92 if (!con) { 92 if (!con) {
93 struct sway_xdg_popup *popup = 93 struct sway_popup_desc *popup =
94 scene_descriptor_try_get(current, SWAY_SCENE_DESC_POPUP); 94 scene_descriptor_try_get(current, SWAY_SCENE_DESC_POPUP);
95 if (popup) { 95 if (popup) {
96 con = popup->view->container; 96 con = popup->view->container;