diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-03-31 00:44:17 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-03-31 15:37:16 -0400 |
commit | 7706d83160267be61accb1b6f7bdc2f43299cae7 (patch) | |
tree | 64b9751ee7edf613c9e3a06d1f5446501f4ddbaf /sway/tree/container.c | |
parent | Merge pull request #1684 from swaywm/follow-warp (diff) | |
download | sway-7706d83160267be61accb1b6f7bdc2f43299cae7.tar.gz sway-7706d83160267be61accb1b6f7bdc2f43299cae7.tar.zst sway-7706d83160267be61accb1b6f7bdc2f43299cae7.zip |
basic split containers
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 746dbf1f..7b88cccb 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -38,7 +38,7 @@ static void notify_new_container(struct sway_container *container) { | |||
38 | ipc_event_window(container, "new"); | 38 | ipc_event_window(container, "new"); |
39 | } | 39 | } |
40 | 40 | ||
41 | static struct sway_container *container_create(enum sway_container_type type) { | 41 | struct sway_container *container_create(enum sway_container_type type) { |
42 | // next id starts at 1 because 0 is assigned to root_container in layout.c | 42 | // next id starts at 1 because 0 is assigned to root_container in layout.c |
43 | static size_t next_id = 1; | 43 | static size_t next_id = 1; |
44 | struct sway_container *c = calloc(1, sizeof(struct sway_container)); | 44 | struct sway_container *c = calloc(1, sizeof(struct sway_container)); |
@@ -66,13 +66,14 @@ struct sway_container *container_destroy(struct sway_container *cont) { | |||
66 | wl_signal_emit(&cont->events.destroy, cont); | 66 | wl_signal_emit(&cont->events.destroy, cont); |
67 | 67 | ||
68 | struct sway_container *parent = cont->parent; | 68 | struct sway_container *parent = cont->parent; |
69 | if (cont->children) { | 69 | if (cont->children != NULL) { |
70 | // remove children until there are no more, container_destroy calls | 70 | // remove children until there are no more, container_destroy calls |
71 | // container_remove_child, which removes child from this container | 71 | // container_remove_child, which removes child from this container |
72 | while (cont->children->length) { | 72 | while (cont->children->length != 0) { |
73 | container_destroy(cont->children->items[0]); | 73 | container_destroy(cont->children->items[0]); |
74 | } | 74 | } |
75 | list_free(cont->children); | 75 | list_free(cont->children); |
76 | cont->children = NULL; | ||
76 | } | 77 | } |
77 | if (cont->marks) { | 78 | if (cont->marks) { |
78 | list_foreach(cont->marks, free); | 79 | list_foreach(cont->marks, free); |