diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-21 12:19:29 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-21 12:19:29 -0700 |
commit | de5196dc1e6427d76d93d9cafe147fedbffbaad4 (patch) | |
tree | c0ec5907817202900b350fa0d82ed4cefb3b2330 /sway/container.c | |
parent | swayc_is_fullscreen (diff) | |
download | sway-de5196dc1e6427d76d93d9cafe147fedbffbaad4.tar.gz sway-de5196dc1e6427d76d93d9cafe147fedbffbaad4.tar.zst sway-de5196dc1e6427d76d93d9cafe147fedbffbaad4.zip |
comments + fixed leak
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sway/container.c b/sway/container.c index 5f1510a9..e6645fd2 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -26,14 +26,11 @@ static void free_swayc(swayc_t *cont) { | |||
26 | if (!ASSERT_NONNULL(cont)) { | 26 | if (!ASSERT_NONNULL(cont)) { |
27 | return; | 27 | return; |
28 | } | 28 | } |
29 | // TODO does not properly handle containers with children, | ||
30 | // TODO but functions that call this usually check for that | ||
31 | if (cont->children) { | 29 | if (cont->children) { |
32 | if (cont->children->length) { | 30 | // remove children until there are no more, free_swayc calls |
33 | int i; | 31 | // remove_child, which removes child from this container |
34 | for (i = 0; i < cont->children->length; ++i) { | 32 | while (cont->children->length) { |
35 | free_swayc(cont->children->items[i]); | 33 | free_swayc(cont->children->items[0]); |
36 | } | ||
37 | } | 34 | } |
38 | list_free(cont->children); | 35 | list_free(cont->children); |
39 | } | 36 | } |
@@ -409,9 +406,13 @@ swayc_t *swayc_active_workspace_for(swayc_t *cont) { | |||
409 | return NULL; | 406 | return NULL; |
410 | } | 407 | } |
411 | switch (cont->type) { | 408 | switch (cont->type) { |
409 | /* set root -> output */ | ||
412 | case C_ROOT: cont = cont->focused; | 410 | case C_ROOT: cont = cont->focused; |
411 | /* set output -> workspace */ | ||
413 | case C_OUTPUT: cont = cont->focused; | 412 | case C_OUTPUT: cont = cont->focused; |
413 | /* return workspace */ | ||
414 | case C_WORKSPACE: return cont; | 414 | case C_WORKSPACE: return cont; |
415 | /* Find parent workspace */ | ||
415 | default: return swayc_parent_by_type(cont, C_WORKSPACE); | 416 | default: return swayc_parent_by_type(cont, C_WORKSPACE); |
416 | } | 417 | } |
417 | } | 418 | } |