summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-03 19:32:09 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-03 19:32:09 -0400
commit035a88e0dc325e8225478632b3d4b02a72fcf29a (patch)
treec84f33a55af37326b19225d0dd7e099dde25982f
parentaddress feedback (diff)
downloadsway-035a88e0dc325e8225478632b3d4b02a72fcf29a.tar.gz
sway-035a88e0dc325e8225478632b3d4b02a72fcf29a.tar.zst
sway-035a88e0dc325e8225478632b3d4b02a72fcf29a.zip
rename container_finish to _container_destroy
-rw-r--r--sway/tree/container.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 77c61b3f..2fd03067 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -77,21 +77,21 @@ struct sway_container *container_create(enum sway_container_type type) {
77 return c; 77 return c;
78} 78}
79 79
80static struct sway_container *container_finish(struct sway_container *cont) { 80static void _container_destroy(struct sway_container *cont) {
81 if (cont == NULL) { 81 if (cont == NULL) {
82 return NULL; 82 return;
83 } 83 }
84 84
85 wl_signal_emit(&cont->events.destroy, cont); 85 wl_signal_emit(&cont->events.destroy, cont);
86 86
87 struct sway_container *parent = cont->parent; 87 struct sway_container *parent = cont->parent;
88 if (cont->children != NULL) { 88 if (cont->children != NULL && cont->children->length) {
89 // remove children until there are no more, container_destroy calls 89 // remove children until there are no more, container_destroy calls
90 // container_remove_child, which removes child from this container 90 // container_remove_child, which removes child from this container
91 while (cont->children != NULL && cont->children->length != 0) { 91 while (cont->children != NULL) {
92 struct sway_container *child = cont->children->items[0]; 92 struct sway_container *child = cont->children->items[0];
93 container_remove_child(child); 93 container_remove_child(child);
94 container_finish(child); 94 _container_destroy(child);
95 } 95 }
96 } 96 }
97 if (cont->marks) { 97 if (cont->marks) {
@@ -107,7 +107,6 @@ static struct sway_container *container_finish(struct sway_container *cont) {
107 list_free(cont->children); 107 list_free(cont->children);
108 cont->children = NULL; 108 cont->children = NULL;
109 free(cont); 109 free(cont);
110 return parent;
111} 110}
112 111
113static struct sway_container *container_output_destroy( 112static struct sway_container *container_output_destroy(
@@ -143,7 +142,7 @@ static struct sway_container *container_output_destroy(
143 wl_list_remove(&output->sway_output->damage_frame.link); 142 wl_list_remove(&output->sway_output->damage_frame.link);
144 143
145 wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); 144 wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
146 container_finish(output); 145 _container_destroy(output);
147 return &root_container; 146 return &root_container;
148} 147}
149 148
@@ -182,7 +181,7 @@ static struct sway_container *container_workspace_destroy(
182 } 181 }
183 } 182 }
184 183
185 container_finish(workspace); 184 _container_destroy(workspace);
186 return parent; 185 return parent;
187} 186}
188 187
@@ -204,14 +203,14 @@ static bool container_reap_empty(struct sway_container *con) {
204 break; 203 break;
205 case C_CONTAINER: 204 case C_CONTAINER:
206 if (con->children->length == 0) { 205 if (con->children->length == 0) {
207 container_finish(con); 206 _container_destroy(con);
208 return true; 207 return true;
209 } else if (con->children->length == 1) { 208 } else if (con->children->length == 1) {
210 struct sway_container *child = con->children->items[0]; 209 struct sway_container *child = con->children->items[0];
211 if (child->type == C_CONTAINER) { 210 if (child->type == C_CONTAINER) {
212 container_remove_child(child); 211 container_remove_child(child);
213 container_replace_child(con, child); 212 container_replace_child(con, child);
214 container_finish(con); 213 _container_destroy(con);
215 return true; 214 return true;
216 } 215 }
217 } 216 }
@@ -252,12 +251,12 @@ struct sway_container *container_destroy(struct sway_container *con) {
252 container_remove_child(child); 251 container_remove_child(child);
253 container_add_child(parent, child); 252 container_add_child(parent, child);
254 } 253 }
255 container_finish(con); 254 _container_destroy(con);
256 } 255 }
257 container_finish(con); 256 _container_destroy(con);
258 break; 257 break;
259 case C_VIEW: 258 case C_VIEW:
260 container_finish(con); 259 _container_destroy(con);
261 break; 260 break;
262 case C_TYPES: 261 case C_TYPES:
263 wlr_log(L_ERROR, "container_destroy called on an invalid " 262 wlr_log(L_ERROR, "container_destroy called on an invalid "