aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index dc51c3be..75fb63f1 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <string.h>
#include <wlr/types/wlr_output_layout.h>
+#include <wlr/types/wlr_scene.h>
#include <wlr/util/transform.h>
#include "sway/desktop/transaction.h"
#include "sway/input/seat.h"
@@ -30,7 +31,33 @@ struct sway_root *root_create(struct wl_display *wl_display) {
sway_log(SWAY_ERROR, "Unable to allocate sway_root");
return NULL;
}
+
+ struct wlr_scene *root_scene = wlr_scene_create();
+ if (!root_scene) {
+ sway_log(SWAY_ERROR, "Unable to allocate root scene node");
+ free(root);
+ return NULL;
+ }
+
node_init(&root->node, N_ROOT, root);
+ root->root_scene = root_scene;
+
+ bool failed = false;
+ root->staging = alloc_scene_tree(&root_scene->tree, &failed);
+
+ root->layers.tiling = alloc_scene_tree(&root_scene->tree, &failed);
+ root->layers.floating = alloc_scene_tree(&root_scene->tree, &failed);
+ root->layers.fullscreen = alloc_scene_tree(&root_scene->tree, &failed);
+ root->layers.fullscreen_global = alloc_scene_tree(&root_scene->tree, &failed);
+
+ if (failed) {
+ wlr_scene_node_destroy(&root_scene->tree.node);
+ free(root);
+ return NULL;
+ }
+
+ wlr_scene_node_set_enabled(&root->staging->node, false);
+
root->output_layout = wlr_output_layout_create(wl_display);
wl_list_init(&root->all_outputs);
#if HAVE_XWAYLAND
@@ -53,6 +80,7 @@ void root_destroy(struct sway_root *root) {
list_free(root->scratchpad);
list_free(root->non_desktop_outputs);
list_free(root->outputs);
+ wlr_scene_node_destroy(&root->root_scene->tree.node);
free(root);
}