aboutsummaryrefslogtreecommitdiffstats
path: root/sway/container.c
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-26 21:25:57 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-26 21:25:57 -0700
commitd11533595133685d15fd6cdbf9f1611be5e8e2f3 (patch)
treeeb8890eb711a55a58e3855c6d9328e3b1dd09063 /sway/container.c
parentMerge pull request #139 from Luminarys/master (diff)
downloadsway-d11533595133685d15fd6cdbf9f1611be5e8e2f3.tar.gz
sway-d11533595133685d15fd6cdbf9f1611be5e8e2f3.tar.zst
sway-d11533595133685d15fd6cdbf9f1611be5e8e2f3.zip
move workspace from dead output to other output
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sway/container.c b/sway/container.c
index 3558809a..a3bc9864 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -281,8 +281,21 @@ swayc_t *destroy_output(swayc_t *output) {
281 if (!ASSERT_NONNULL(output)) { 281 if (!ASSERT_NONNULL(output)) {
282 return NULL; 282 return NULL;
283 } 283 }
284 if (output->children->length == 0) { 284 if (output->children->length > 0) {
285 // TODO move workspaces to other outputs 285 int i, len = root_container.children->length;
286 // TODO save workspaces when there are no outputs.
287 // TODO also check if there will ever be no outputs except for exiting
288 // program
289 if (len > 1) {
290 len = output->children->length;
291 int p = root_container.children->items[0] == output;
292 // Move workspace from this output to another output
293 for (i = 0; i < len; ++i) {
294 swayc_t *child = output->children->items[i];
295 remove_child(child);
296 add_child(root_container.children->items[p], child);
297 }
298 }
286 } 299 }
287 sway_log(L_DEBUG, "OUTPUT: Destroying output '%lu'", output->handle); 300 sway_log(L_DEBUG, "OUTPUT: Destroying output '%lu'", output->handle);
288 free_swayc(output); 301 free_swayc(output);