diff options
-rw-r--r-- | sway/layout.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sway/layout.c b/sway/layout.c index 66cbde99..e2e91593 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -223,20 +223,17 @@ void unfocus_all(swayc_t *container) { | |||
223 | } | 223 | } |
224 | 224 | ||
225 | void focus_view(swayc_t *view) { | 225 | void focus_view(swayc_t *view) { |
226 | sway_log(L_DEBUG, "Setting focus for %p", view); | 226 | sway_log(L_DEBUG, "Setting focus for %p", view); |
227 | if (view == &root_container) { | 227 | while (view != &root_container) { |
228 | // Propegate wayland focus down | 228 | view->parent->focused = view; |
229 | swayc_t *child = view->focused; | 229 | view = view->parent; |
230 | while (child && child->type != C_VIEW) { | 230 | } |
231 | child = child->focused; | 231 | while (view && view->type != C_VIEW) { |
232 | } | 232 | view = view->focused; |
233 | if (child) { | 233 | } |
234 | wlc_view_set_state(child->handle, WLC_BIT_ACTIVATED, true); | 234 | if (view) { |
235 | wlc_view_focus(child->handle); | 235 | wlc_view_set_state(view->handle, WLC_BIT_ACTIVATED, true); |
236 | } | 236 | wlc_view_focus(view->handle); |
237 | return; | ||
238 | } | 237 | } |
239 | view->parent->focused = view; | ||
240 | focus_view(view->parent); | ||
241 | } | 238 | } |
242 | 239 | ||