aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-03 23:06:01 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-04 14:01:20 +1000
commit04489ff4209dc073027419d90961367cfb998fe8 (patch)
treed6f6213d2374e10a875e8ced872511e6e656ae3e /sway/tree/layout.c
parentMerge pull request #2419 from RedSoxFan/fix-2416 (diff)
downloadsway-04489ff4209dc073027419d90961367cfb998fe8.tar.gz
sway-04489ff4209dc073027419d90961367cfb998fe8.tar.zst
sway-04489ff4209dc073027419d90961367cfb998fe8.zip
Separate root-related code
This creates a root.c and moves bits and pieces from elsewhere into it. * layout_init has been renamed to root_create and moved into root.c * root_destroy has been created and is called on shutdown * scratchpad code has been moved into root.c, because hidden scratchpad containers are stored in the root struct
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 1f82e534..07de9664 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -19,40 +19,6 @@
19#include "list.h" 19#include "list.h"
20#include "log.h" 20#include "log.h"
21 21
22struct sway_container root_container;
23
24static void output_layout_handle_change(struct wl_listener *listener,
25 void *data) {
26 arrange_windows(&root_container);
27 transaction_commit_dirty();
28}
29
30void layout_init(void) {
31 root_container.id = 0; // normally assigned in new_swayc()
32 root_container.type = C_ROOT;
33 root_container.layout = L_NONE;
34 root_container.name = strdup("root");
35 root_container.instructions = create_list();
36 root_container.children = create_list();
37 root_container.current.children = create_list();
38 wl_signal_init(&root_container.events.destroy);
39
40 root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
41 root_container.sway_root->output_layout = wlr_output_layout_create();
42 wl_list_init(&root_container.sway_root->outputs);
43#ifdef HAVE_XWAYLAND
44 wl_list_init(&root_container.sway_root->xwayland_unmanaged);
45#endif
46 wl_list_init(&root_container.sway_root->drag_icons);
47 wl_signal_init(&root_container.sway_root->events.new_container);
48 root_container.sway_root->scratchpad = create_list();
49
50 root_container.sway_root->output_layout_change.notify =
51 output_layout_handle_change;
52 wl_signal_add(&root_container.sway_root->output_layout->events.change,
53 &root_container.sway_root->output_layout_change);
54}
55
56static int index_child(const struct sway_container *child) { 22static int index_child(const struct sway_container *child) {
57 struct sway_container *parent = child->parent; 23 struct sway_container *parent = child->parent;
58 for (int i = 0; i < parent->children->length; ++i) { 24 for (int i = 0; i < parent->children->length; ++i) {