aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2024-01-18 10:00:45 -0500
committerKirill Primak <vyivel@eclair.cafe>2024-01-18 18:36:54 +0300
commit1eb16d136774c8fb3c9085df45156264f0db8814 (patch)
tree9c348ab37edae50b76a388d7e8d8dcd011cea33b /sway/tree/workspace.c
parentdbd2fbf4301d441be4f9a04a1df6d93c81c361f6 (diff)
scene_graph: Maintain `wlr_scene_node`s for the sway tree.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 18218768..f60b2366 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -71,6 +71,18 @@ struct sway_workspace *workspace_create(struct sway_output *output,
return NULL;
}
node_init(&ws->node, N_WORKSPACE, ws);
+
+ bool failed = false;
+ ws->layers.tiling = alloc_scene_tree(root->staging, &failed);
+ ws->layers.fullscreen = alloc_scene_tree(root->staging, &failed);
+
+ if (failed) {
+ wlr_scene_node_destroy(&ws->layers.tiling->node);
+ wlr_scene_node_destroy(&ws->layers.fullscreen->node);
+ free(ws);
+ return NULL;
+ }
+
ws->name = strdup(name);
ws->prev_split_layout = L_NONE;
ws->layout = output_get_default_layout(output);
@@ -131,6 +143,11 @@ void workspace_destroy(struct sway_workspace *workspace) {
return;
}
+ scene_node_disown_children(workspace->layers.tiling);
+ scene_node_disown_children(workspace->layers.fullscreen);
+ wlr_scene_node_destroy(&workspace->layers.tiling->node);
+ wlr_scene_node_destroy(&workspace->layers.fullscreen->node);
+
free(workspace->name);
free(workspace->representation);
list_free_items_and_destroy(workspace->output_priority);