aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2024-01-23 10:17:26 -0500
committerKirill Primak <vyivel@eclair.cafe>2024-02-12 19:19:22 +0300
commit1846944f0454fec08ad91a04ab04e3b1ffcd1764 (patch)
tree76b6cea3f679e8eff228001654fa43a6a9aa8f47 /sway/desktop
parent1dc661af176d80db8b283e9c38fd127f71d33052 (diff)
xdg_shell: Extract struct for popup descriptor
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/transaction.c8
-rw-r--r--sway/desktop/xdg_shell.c5
2 files changed, 7 insertions, 6 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) {
void arrange_popups(struct wlr_scene_tree *popups) {
struct wlr_scene_node *node;
wl_list_for_each(node, &popups->children, link) {
- struct sway_xdg_popup *popup = scene_descriptor_try_get(node,
+ struct sway_popup_desc *popup = scene_descriptor_try_get(node,
SWAY_SCENE_DESC_POPUP);
// the popup layer may have popups from layer_shell surfaces, in this
// case those don't have a scene descriptor, so lets skip those here.
if (popup) {
- struct wlr_scene_tree *tree = popup->view->content_tree;
-
int lx, ly;
- wlr_scene_node_coords(&tree->node, &lx, &ly);
- wlr_scene_node_set_position(&popup->scene_tree->node, lx, ly);
+ wlr_scene_node_coords(popup->relative, &lx, &ly);
+ wlr_scene_node_set_position(node, lx, ly);
}
}
}
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,
return NULL;
}
+ popup->desc.relative = &view->content_tree->node;
+ popup->desc.view = view;
+
if (!scene_descriptor_assign(&popup->scene_tree->node,
- SWAY_SCENE_DESC_POPUP, popup)) {
+ SWAY_SCENE_DESC_POPUP, &popup->desc)) {
sway_log(SWAY_ERROR, "Failed to allocate a popup scene descriptor");
wlr_scene_node_destroy(&popup->scene_tree->node);
free(popup);