diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-03 12:34:01 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-03 12:34:01 -0400 |
commit | 09d448ea2df60b7e4504b1ec4728e7f1df0244b7 (patch) | |
tree | 7555d93cbc9f701a173044dc3d4e437d1db95f67 /sway/tree/output.c | |
parent | move view and workspace destructors to container.c (diff) | |
download | sway-09d448ea2df60b7e4504b1ec4728e7f1df0244b7.tar.gz sway-09d448ea2df60b7e4504b1ec4728e7f1df0244b7.tar.zst sway-09d448ea2df60b7e4504b1ec4728e7f1df0244b7.zip |
unify container destroy functions
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r-- | sway/tree/output.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c index 0509db23..af17b856 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -4,42 +4,6 @@ | |||
4 | #include "sway/output.h" | 4 | #include "sway/output.h" |
5 | #include "log.h" | 5 | #include "log.h" |
6 | 6 | ||
7 | struct sway_container *container_output_destroy(struct sway_container *output) { | ||
8 | if (!sway_assert(output, "cannot destroy null output")) { | ||
9 | return NULL; | ||
10 | } | ||
11 | |||
12 | if (output->children->length > 0) { | ||
13 | // TODO save workspaces when there are no outputs. | ||
14 | // TODO also check if there will ever be no outputs except for exiting | ||
15 | // program | ||
16 | if (root_container.children->length > 1) { | ||
17 | int p = root_container.children->items[0] == output; | ||
18 | // Move workspace from this output to another output | ||
19 | while (output->children->length) { | ||
20 | struct sway_container *child = output->children->items[0]; | ||
21 | container_remove_child(child); | ||
22 | container_add_child(root_container.children->items[p], child); | ||
23 | } | ||
24 | container_sort_workspaces(root_container.children->items[p]); | ||
25 | arrange_windows(root_container.children->items[p], | ||
26 | -1, -1); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | wl_list_remove(&output->sway_output->destroy.link); | ||
31 | wl_list_remove(&output->sway_output->mode.link); | ||
32 | wl_list_remove(&output->sway_output->transform.link); | ||
33 | wl_list_remove(&output->sway_output->scale.link); | ||
34 | |||
35 | wl_list_remove(&output->sway_output->damage_destroy.link); | ||
36 | wl_list_remove(&output->sway_output->damage_frame.link); | ||
37 | |||
38 | wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); | ||
39 | container_destroy(output); | ||
40 | return &root_container; | ||
41 | } | ||
42 | |||
43 | struct sway_container *output_by_name(const char *name) { | 7 | struct sway_container *output_by_name(const char *name) { |
44 | for (int i = 0; i < root_container.children->length; ++i) { | 8 | for (int i = 0; i < root_container.children->length; ++i) { |
45 | struct sway_container *output = root_container.children->items[i]; | 9 | struct sway_container *output = root_container.children->items[i]; |