scene_graph: Maintain wlr_scene_nodes for the sway tree.

This commit is contained in:
Alexander Orzechowski 2022-08-31 23:42:15 -04:00 committed by Kirill Primak
parent a33ede4c43
commit 25da7b237d
13 changed files with 286 additions and 6 deletions

View file

@ -69,6 +69,18 @@ struct sway_workspace *workspace_create(struct sway_output *output,
return NULL;
}
node_init(&ws->node, N_WORKSPACE, ws);
bool alloc_failure = false;
ws->layers.tiling = alloc_scene_tree(root->staging, &alloc_failure);
ws->layers.fullscreen = alloc_scene_tree(root->staging, &alloc_failure);
if (alloc_failure) {
wlr_scene_node_destroy(&ws->layers.tiling->node);
wlr_scene_node_destroy(&ws->layers.fullscreen->node);
free(ws);
return NULL;
}
ws->name = name ? strdup(name) : NULL;
ws->prev_split_layout = L_NONE;
ws->layout = output_get_default_layout(output);
@ -129,6 +141,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);