diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2024-01-18 10:00:45 -0500 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2024-01-18 18:36:54 +0300 |
commit | 1eb16d136774c8fb3c9085df45156264f0db8814 (patch) | |
tree | 9c348ab37edae50b76a388d7e8d8dcd011cea33b /sway/tree/workspace.c | |
parent | view: init function should return a success bool (diff) | |
download | sway-1eb16d136774c8fb3c9085df45156264f0db8814.tar.gz sway-1eb16d136774c8fb3c9085df45156264f0db8814.tar.zst sway-1eb16d136774c8fb3c9085df45156264f0db8814.zip |
scene_graph: Maintain `wlr_scene_node`s for the sway tree.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 17 |
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, | |||
71 | return NULL; | 71 | return NULL; |
72 | } | 72 | } |
73 | node_init(&ws->node, N_WORKSPACE, ws); | 73 | node_init(&ws->node, N_WORKSPACE, ws); |
74 | |||
75 | bool failed = false; | ||
76 | ws->layers.tiling = alloc_scene_tree(root->staging, &failed); | ||
77 | ws->layers.fullscreen = alloc_scene_tree(root->staging, &failed); | ||
78 | |||
79 | if (failed) { | ||
80 | wlr_scene_node_destroy(&ws->layers.tiling->node); | ||
81 | wlr_scene_node_destroy(&ws->layers.fullscreen->node); | ||
82 | free(ws); | ||
83 | return NULL; | ||
84 | } | ||
85 | |||
74 | ws->name = strdup(name); | 86 | ws->name = strdup(name); |
75 | ws->prev_split_layout = L_NONE; | 87 | ws->prev_split_layout = L_NONE; |
76 | ws->layout = output_get_default_layout(output); | 88 | ws->layout = output_get_default_layout(output); |
@@ -131,6 +143,11 @@ void workspace_destroy(struct sway_workspace *workspace) { | |||
131 | return; | 143 | return; |
132 | } | 144 | } |
133 | 145 | ||
146 | scene_node_disown_children(workspace->layers.tiling); | ||
147 | scene_node_disown_children(workspace->layers.fullscreen); | ||
148 | wlr_scene_node_destroy(&workspace->layers.tiling->node); | ||
149 | wlr_scene_node_destroy(&workspace->layers.fullscreen->node); | ||
150 | |||
134 | free(workspace->name); | 151 | free(workspace->name); |
135 | free(workspace->representation); | 152 | free(workspace->representation); |
136 | list_free_items_and_destroy(workspace->output_priority); | 153 | list_free_items_and_destroy(workspace->output_priority); |