diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-21 12:41:54 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-21 12:41:54 -0700 |
commit | b05317c3a60c751ee4fbc596182b02f568b71c2e (patch) | |
tree | 03225a0c3680eba06f2c544a9e753a0e5aa58f1d | |
parent | comments + fixed leak (diff) | |
download | sway-b05317c3a60c751ee4fbc596182b02f568b71c2e.tar.gz sway-b05317c3a60c751ee4fbc596182b02f568b71c2e.tar.zst sway-b05317c3a60c751ee4fbc596182b02f568b71c2e.zip |
style
-rw-r--r-- | sway/container.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sway/container.c b/sway/container.c index e6645fd2..62ff1c4a 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -341,7 +341,7 @@ swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type) { | |||
341 | } | 341 | } |
342 | do { | 342 | do { |
343 | container = container->parent; | 343 | container = container->parent; |
344 | } while(container && container->type != type); | 344 | } while (container && container->type != type); |
345 | return container; | 345 | return container; |
346 | } | 346 | } |
347 | 347 | ||
@@ -402,18 +402,23 @@ swayc_t *swayc_active_workspace(void) { | |||
402 | } | 402 | } |
403 | 403 | ||
404 | swayc_t *swayc_active_workspace_for(swayc_t *cont) { | 404 | swayc_t *swayc_active_workspace_for(swayc_t *cont) { |
405 | if (! cont) { | 405 | if (!cont) { |
406 | return NULL; | 406 | return NULL; |
407 | } | 407 | } |
408 | switch (cont->type) { | 408 | switch (cont->type) { |
409 | /* set root -> output */ | 409 | case C_ROOT: |
410 | case C_ROOT: cont = cont->focused; | 410 | cont = cont->focused; |
411 | /* set output -> workspace */ | 411 | /* Fallthrough */ |
412 | case C_OUTPUT: cont = cont->focused; | 412 | |
413 | /* return workspace */ | 413 | case C_OUTPUT: |
414 | case C_WORKSPACE: return cont; | 414 | cont = cont->focused; |
415 | /* Find parent workspace */ | 415 | /* Fallthrough */ |
416 | default: return swayc_parent_by_type(cont, C_WORKSPACE); | 416 | |
417 | case C_WORKSPACE: | ||
418 | return cont; | ||
419 | |||
420 | default: | ||
421 | return swayc_parent_by_type(cont, C_WORKSPACE); | ||
417 | } | 422 | } |
418 | } | 423 | } |
419 | 424 | ||