aboutsummaryrefslogtreecommitdiffstats
path: root/sway/focus.c
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-21 22:01:36 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-21 23:07:52 +0100
commit50b04884b65b7e04234e8fa794a4e6db48c133a4 (patch)
treeebf8c63bfb812a5d8bd7ab455a5b68ef81054dd2 /sway/focus.c
parentMerge pull request #390 from mikkeloscar/workspace-ipc-event (diff)
downloadsway-50b04884b65b7e04234e8fa794a4e6db48c133a4.tar.gz
sway-50b04884b65b7e04234e8fa794a4e6db48c133a4.tar.zst
sway-50b04884b65b7e04234e8fa794a4e6db48c133a4.zip
Trigger ipc_event_workspace in all cases
This makes sure that the workspace IPC event is triggered when needed. Fixes #382 while making sure that the IPC event is only triggered once.
Diffstat (limited to 'sway/focus.c')
-rw-r--r--sway/focus.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sway/focus.c b/sway/focus.c
index c1170ca4..cf0ee7f6 100644
--- a/sway/focus.c
+++ b/sway/focus.c
@@ -34,7 +34,7 @@ static void update_focus(swayc_t *c) {
34 // Case where workspace changes 34 // Case where workspace changes
35 case C_WORKSPACE: 35 case C_WORKSPACE:
36 if (prev) { 36 if (prev) {
37 ipc_event_workspace(prev, c); 37 ipc_event_workspace(prev, c, "focus");
38 // update visibility of old workspace 38 // update visibility of old workspace
39 update_visibility(prev); 39 update_visibility(prev);
40 40
@@ -122,11 +122,6 @@ bool set_focused_container(swayc_t *c) {
122 p = p->parent; 122 p = p->parent;
123 p->is_focused = false; 123 p->is_focused = false;
124 } 124 }
125 // active_ws might have been destroyed by now
126 // (focus swap away from empty ws = destroy ws)
127 if (active_ws_child_count == 0) {
128 active_ws = NULL;
129 }
130 125
131 // get new focused view and set focus to it. 126 // get new focused view and set focus to it.
132 p = get_focused_view(c); 127 p = get_focused_view(c);
@@ -146,7 +141,13 @@ bool set_focused_container(swayc_t *c) {
146 } 141 }
147 142
148 if (active_ws != workspace) { 143 if (active_ws != workspace) {
149 ipc_event_workspace(active_ws, workspace); 144 // active_ws might have been destroyed by now
145 // (focus swap away from empty ws = destroy ws)
146 if (active_ws_child_count == 0) {
147 active_ws = NULL;
148 }
149
150 ipc_event_workspace(active_ws, workspace, "focus");
150 } 151 }
151 return true; 152 return true;
152} 153}