diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-28 07:41:36 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-28 07:41:36 -0400 |
commit | 9751fff5c51ba9e4d046e3fd3df5dd3f07ab069b (patch) | |
tree | f24d9614b7d0be9163d0abe224f8aa283aff9238 /sway/focus.c | |
parent | 930d136196f12fc13380c68058c52d86107561cd (diff) | |
parent | 4757ea6a1212dab6ee82421a20b152d1f16e44fb (diff) |
Merge pull request #145 from taiyu-len/master
use previous output containers
Diffstat (limited to 'sway/focus.c')
-rw-r--r-- | sway/focus.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sway/focus.c b/sway/focus.c index f7b55b27..45108a11 100644 --- a/sway/focus.c +++ b/sway/focus.c @@ -14,6 +14,10 @@ static void update_focus(swayc_t *c) { // Handle if focus switches swayc_t *parent = c->parent; if (parent->focused != c) { + // Get previous focus + swayc_t *prev = parent->focused; + // Set new focus + parent->focused = c; switch (c->type) { // Shouldnt happen case C_ROOT: return; @@ -25,16 +29,13 @@ static void update_focus(swayc_t *c) { // Case where workspace changes case C_WORKSPACE: - if (parent->focused) { - swayc_t *ws = parent->focused; - // hide visibility of old workspace - bool visible = false; - container_map(ws, set_view_visibility, &visible); - // set visibility of new workspace - visible = true; - container_map(c, set_view_visibility, &visible); - destroy_workspace(ws); + if (prev) { + // update visibility of old workspace + update_visibility(prev); + destroy_workspace(prev); } + // Update visibility of newly focused workspace + update_visibility(c); break; default: @@ -44,7 +45,6 @@ static void update_focus(swayc_t *c) { // for example, stacked and tabbing change stuff. break; } - c->parent->focused = c; } } |