aboutsummaryrefslogtreecommitdiff
path: root/include/sway/tree
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-03 23:06:01 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-08-04 14:01:20 +1000
commit04489ff4209dc073027419d90961367cfb998fe8 (patch)
treed6f6213d2374e10a875e8ced872511e6e656ae3e /include/sway/tree
parent5de2223c6df480759ee6d8f4422c2643491595d0 (diff)
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 'include/sway/tree')
-rw-r--r--include/sway/tree/layout.h23
-rw-r--r--include/sway/tree/root.h57
2 files changed, 58 insertions, 22 deletions
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
index a4c31bf6..77cd954b 100644
--- a/include/sway/tree/layout.h
+++ b/include/sway/tree/layout.h
@@ -3,6 +3,7 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/render/wlr_texture.h>
#include "sway/tree/container.h"
+#include "sway/tree/root.h"
#include "config.h"
enum movement_direction {
@@ -24,28 +25,6 @@ enum resize_edge {
struct sway_container;
-struct sway_root {
- struct wlr_output_layout *output_layout;
-
- struct wl_listener output_layout_change;
-#ifdef HAVE_XWAYLAND
- struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
-#endif
- struct wl_list drag_icons; // sway_drag_icon::link
-
- struct wlr_texture *debug_tree;
-
- struct wl_list outputs; // sway_output::link
-
- list_t *scratchpad; // struct sway_container
-
- struct {
- struct wl_signal new_container;
- } events;
-};
-
-void layout_init(void);
-
void container_add_child(struct sway_container *parent,
struct sway_container *child);
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h
new file mode 100644
index 00000000..ada3c73f
--- /dev/null
+++ b/include/sway/tree/root.h
@@ -0,0 +1,57 @@
+#ifndef _SWAY_ROOT_H
+#define _SWAY_ROOT_H
+#include <wayland-server-core.h>
+#include <wayland-util.h>
+#include <wlr/types/wlr_output_layout.h>
+#include <wlr/render/wlr_texture.h>
+#include "sway/tree/container.h"
+#include "config.h"
+#include "list.h"
+
+extern struct sway_container root_container;
+
+struct sway_root {
+ struct wlr_output_layout *output_layout;
+
+ struct wl_listener output_layout_change;
+#ifdef HAVE_XWAYLAND
+ struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
+#endif
+ struct wl_list drag_icons; // sway_drag_icon::link
+
+ struct wlr_texture *debug_tree;
+
+ struct wl_list outputs; // sway_output::link
+
+ list_t *scratchpad; // struct sway_container
+
+ struct {
+ struct wl_signal new_container;
+ } events;
+};
+
+void root_create(void);
+
+void root_destroy(void);
+
+/**
+ * Move a container to the scratchpad.
+ */
+void root_scratchpad_add_container(struct sway_container *con);
+
+/**
+ * Remove a container from the scratchpad.
+ */
+void root_scratchpad_remove_container(struct sway_container *con);
+
+/**
+ * Show a single scratchpad container.
+ */
+void root_scratchpad_show(struct sway_container *con);
+
+/**
+ * Hide a single scratchpad container.
+ */
+void root_scratchpad_hide(struct sway_container *con);
+
+#endif