aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/output.c28
-rw-r--r--sway/tree/root.c1
2 files changed, 29 insertions, 0 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 52826c91..b30e646e 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -9,6 +9,7 @@
#include "sway/output.h"
#include "sway/tree/arrange.h"
#include "sway/tree/workspace.h"
+#include "sway/server.h"
#include "log.h"
#include "util.h"
@@ -390,6 +391,33 @@ void output_get_box(struct sway_output *output, struct wlr_box *box) {
box->height = output->height;
}
+static void handle_destroy_non_desktop(struct wl_listener *listener, void *data) {
+ struct sway_output_non_desktop *output =
+ wl_container_of(listener, output, destroy);
+
+ sway_log(SWAY_DEBUG, "Destroying non-desktop output '%s'", output->wlr_output->name);
+
+ int index = list_find(root->non_desktop_outputs, output);
+ list_del(root->non_desktop_outputs, index);
+
+ wl_list_remove(&output->destroy.link);
+
+ free(output);
+}
+
+struct sway_output_non_desktop *output_non_desktop_create(
+ struct wlr_output *wlr_output) {
+ struct sway_output_non_desktop *output =
+ calloc(1, sizeof(struct sway_output_non_desktop));
+
+ output->wlr_output = wlr_output;
+
+ wl_signal_add(&wlr_output->events.destroy, &output->destroy);
+ output->destroy.notify = handle_destroy_non_desktop;
+
+ return output;
+}
+
enum sway_container_layout output_get_default_layout(
struct sway_output *output) {
if (config->default_orientation != L_NONE) {
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 8508e9eb..7df0b237 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -38,6 +38,7 @@ struct sway_root *root_create(void) {
wl_list_init(&root->drag_icons);
wl_signal_init(&root->events.new_node);
root->outputs = create_list();
+ root->non_desktop_outputs = create_list();
root->scratchpad = create_list();
root->output_layout_change.notify = output_layout_handle_change;