aboutsummaryrefslogtreecommitdiff
path: root/sway/focus.c
diff options
context:
space:
mode:
authortaiyu <taiyu.len@gmail.com>2015-08-27 23:18:28 -0700
committertaiyu <taiyu.len@gmail.com>2015-08-27 23:18:28 -0700
commit5678d824e43d1ae2e2abaa1bc9a03391a4683a86 (patch)
treec097bfa46406f94903e942832e36bd3e96d343bb /sway/focus.c
parentdfe0dda8d02a3cce27f3fa68e00293e32e90b6a7 (diff)
update visibility + container info functions
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) {
// 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;
}
}