aboutsummaryrefslogtreecommitdiffstats
path: root/sway/focus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/focus.c')
-rw-r--r--sway/focus.c20
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) {
14 // Handle if focus switches 14 // Handle if focus switches
15 swayc_t *parent = c->parent; 15 swayc_t *parent = c->parent;
16 if (parent->focused != c) { 16 if (parent->focused != c) {
17 // Get previous focus
18 swayc_t *prev = parent->focused;
19 // Set new focus
20 parent->focused = c;
17 switch (c->type) { 21 switch (c->type) {
18 // Shouldnt happen 22 // Shouldnt happen
19 case C_ROOT: return; 23 case C_ROOT: return;
@@ -25,16 +29,13 @@ static void update_focus(swayc_t *c) {
25 29
26 // Case where workspace changes 30 // Case where workspace changes
27 case C_WORKSPACE: 31 case C_WORKSPACE:
28 if (parent->focused) { 32 if (prev) {
29 swayc_t *ws = parent->focused; 33 // update visibility of old workspace
30 // hide visibility of old workspace 34 update_visibility(prev);
31 bool visible = false; 35 destroy_workspace(prev);
32 container_map(ws, set_view_visibility, &visible);
33 // set visibility of new workspace
34 visible = true;
35 container_map(c, set_view_visibility, &visible);
36 destroy_workspace(ws);
37 } 36 }
37 // Update visibility of newly focused workspace
38 update_visibility(c);
38 break; 39 break;
39 40
40 default: 41 default:
@@ -44,7 +45,6 @@ static void update_focus(swayc_t *c) {
44 // for example, stacked and tabbing change stuff. 45 // for example, stacked and tabbing change stuff.
45 break; 46 break;
46 } 47 }
47 c->parent->focused = c;
48 } 48 }
49} 49}
50 50