aboutsummaryrefslogtreecommitdiff
path: root/sway/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/layout.c')
-rw-r--r--sway/layout.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 8b9315b4..e2e91593 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -223,16 +223,17 @@ void unfocus_all(swayc_t *container) {
}
void focus_view(swayc_t *view) {
- sway_log(L_DEBUG, "Setting focus to %p", view);
- if (view->type == C_VIEW) {
- wlc_view_set_state(view->handle, WLC_BIT_ACTIVATED, true);
- wlc_view_bring_to_front(view->handle);
- wlc_view_focus(view->handle);
- }
- // Propagete focus up
+ sway_log(L_DEBUG, "Setting focus for %p", view);
while (view != &root_container) {
view->parent->focused = view;
view = view->parent;
}
+ while (view && view->type != C_VIEW) {
+ view = view->focused;
+ }
+ if (view) {
+ wlc_view_set_state(view->handle, WLC_BIT_ACTIVATED, true);
+ wlc_view_focus(view->handle);
+ }
}