diff options
Diffstat (limited to 'sway/focus.c')
-rw-r--r-- | sway/focus.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sway/focus.c b/sway/focus.c index 0f629e1e..576a5e9b 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -115,7 +115,7 @@ bool set_focused_container(swayc_t *c) { | |||
115 | 115 | ||
116 | // Get workspace for c, get that workspaces current focused container. | 116 | // Get workspace for c, get that workspaces current focused container. |
117 | swayc_t *workspace = swayc_active_workspace_for(c); | 117 | swayc_t *workspace = swayc_active_workspace_for(c); |
118 | swayc_t *focused = get_focused_view(workspace); | 118 | swayc_t *focused = get_focused_container(workspace); |
119 | 119 | ||
120 | if (swayc_is_fullscreen(focused) && focused != c) { | 120 | if (swayc_is_fullscreen(focused) && focused != c) { |
121 | // if switching to a workspace with a fullscreen view, | 121 | // if switching to a workspace with a fullscreen view, |
@@ -140,33 +140,32 @@ bool set_focused_container(swayc_t *c) { | |||
140 | } | 140 | } |
141 | 141 | ||
142 | // get new focused view and set focus to it. | 142 | // get new focused view and set focus to it. |
143 | p = get_focused_view(c); | 143 | if (c->type == C_CONTAINER || (c->type == C_VIEW && !(wlc_view_get_type(p->handle) & WLC_BIT_POPUP))) { |
144 | if (p->type == C_VIEW && !(wlc_view_get_type(p->handle) & WLC_BIT_POPUP)) { | ||
145 | // unactivate previous focus | 144 | // unactivate previous focus |
146 | if (focused->type == C_VIEW) { | 145 | if (focused->type == C_VIEW) { |
147 | wlc_view_set_state(focused->handle, WLC_BIT_ACTIVATED, false); | 146 | wlc_view_set_state(focused->handle, WLC_BIT_ACTIVATED, false); |
148 | update_view_border(focused); | ||
149 | } | 147 | } |
148 | update_container_border(focused); | ||
150 | // activate current focus | 149 | // activate current focus |
151 | if (p->type == C_VIEW) { | 150 | if (c->type == C_VIEW) { |
152 | wlc_view_set_state(p->handle, WLC_BIT_ACTIVATED, true); | 151 | wlc_view_set_state(c->handle, WLC_BIT_ACTIVATED, true); |
153 | // set focus if view_focus is unlocked | 152 | } |
154 | if (!locked_view_focus) { | 153 | // set focus if view_focus is unlocked |
155 | wlc_view_focus(p->handle); | 154 | if (!locked_view_focus) { |
156 | if (p->parent->layout != L_TABBED | 155 | wlc_view_focus(c->handle); |
157 | && p->parent->layout != L_STACKED) { | 156 | if (c->parent->layout != L_TABBED |
158 | update_view_border(p); | 157 | && c->parent->layout != L_STACKED) { |
159 | } | 158 | update_container_border(c); |
160 | } | 159 | } |
161 | } | 160 | } |
162 | 161 | ||
163 | // rearrange if parent container is tabbed/stacked | 162 | // rearrange if parent container is tabbed/stacked |
164 | swayc_t *parent = swayc_tabbed_stacked_ancestor(p); | 163 | swayc_t *parent = swayc_tabbed_stacked_ancestor(c); |
165 | if (parent != NULL) { | 164 | if (parent != NULL) { |
166 | arrange_backgrounds(); | 165 | arrange_backgrounds(); |
167 | arrange_windows(parent, -1, -1); | 166 | arrange_windows(parent, -1, -1); |
168 | } | 167 | } |
169 | } else if (p->type == C_WORKSPACE) { | 168 | } else if (c->type == C_WORKSPACE) { |
170 | // remove previous focus if view_focus is unlocked | 169 | // remove previous focus if view_focus is unlocked |
171 | if (!locked_view_focus) { | 170 | if (!locked_view_focus) { |
172 | wlc_view_focus(0); | 171 | wlc_view_focus(0); |