diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-15 16:03:45 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-15 16:03:45 -0400 |
commit | f606508bccac841925e8d669fe90595697fac8af (patch) | |
tree | e150b723ffb01ab4b482fc9f7d2fccda8daaf6bf | |
parent | Fix build (diff) | |
download | sway-f606508bccac841925e8d669fe90595697fac8af.tar.gz sway-f606508bccac841925e8d669fe90595697fac8af.tar.zst sway-f606508bccac841925e8d669fe90595697fac8af.zip |
Fix switching focus between outputs
-rw-r--r-- | sway/container.c | 1 | ||||
-rw-r--r-- | sway/workspace.c | 18 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sway/container.c b/sway/container.c index 189f064b..98941b2c 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -157,6 +157,7 @@ swayc_t *destroy_output(swayc_t *output) { | |||
157 | } | 157 | } |
158 | 158 | ||
159 | swayc_t *destroy_workspace(swayc_t *workspace) { | 159 | swayc_t *destroy_workspace(swayc_t *workspace) { |
160 | //NOTE: This is called from elsewhere without checking children length | ||
160 | //TODO move containers to other workspaces? | 161 | //TODO move containers to other workspaces? |
161 | //for now just dont delete | 162 | //for now just dont delete |
162 | if (workspace->children->length == 0) { | 163 | if (workspace->children->length == 0) { |
diff --git a/sway/workspace.c b/sway/workspace.c index 9748c23f..6f46dd6b 100644 --- a/sway/workspace.c +++ b/sway/workspace.c | |||
@@ -94,7 +94,7 @@ swayc_t *workspace_find_by_name(const char* name) { | |||
94 | } | 94 | } |
95 | 95 | ||
96 | void workspace_switch(swayc_t *workspace) { | 96 | void workspace_switch(swayc_t *workspace) { |
97 | swayc_t *parent = workspace; | 97 | swayc_t *parent = workspace->parent; |
98 | while (parent->type != C_OUTPUT) { | 98 | while (parent->type != C_OUTPUT) { |
99 | parent = parent->parent; | 99 | parent = parent->parent; |
100 | } | 100 | } |
@@ -111,11 +111,21 @@ void workspace_switch(swayc_t *workspace) { | |||
111 | container_map(workspace, set_mask, &mask); | 111 | container_map(workspace, set_mask, &mask); |
112 | wlc_output_set_mask(wlc_get_focused_output(), 2); | 112 | wlc_output_set_mask(wlc_get_focused_output(), 2); |
113 | 113 | ||
114 | unfocus_all(&root_container); | ||
115 | focus_view(workspace); | ||
116 | |||
117 | destroy_workspace(c_workspace); | 114 | destroy_workspace(c_workspace); |
118 | } | 115 | } |
116 | unfocus_all(&root_container); | ||
117 | focus_view(workspace); | ||
118 | |||
119 | // focus the output this workspace is on | ||
120 | swayc_t *output = workspace->parent; | ||
121 | sway_log(L_DEBUG, "Switching focus to output %p (%d)", output, output->type); | ||
122 | while (output && output->type != C_OUTPUT) { | ||
123 | output = output->parent; | ||
124 | } | ||
125 | if (output) { | ||
126 | sway_log(L_DEBUG, "Switching focus to output %p (%d)", output, output->type); | ||
127 | wlc_output_focus(output->handle); | ||
128 | } | ||
119 | active_workspace = workspace; | 129 | active_workspace = workspace; |
120 | } | 130 | } |
121 | 131 | ||