From 5678d824e43d1ae2e2abaa1bc9a03391a4683a86 Mon Sep 17 00:00:00 2001 From: taiyu Date: Thu, 27 Aug 2015 23:18:28 -0700 Subject: update visibility + container info functions --- sway/focus.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'sway/focus.c') 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; } } -- cgit v1.2.3