diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-15 08:27:51 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-15 08:27:51 -0700 |
commit | cd0cdc28aa6578d0a8fb0a27c5dd07052320e734 (patch) | |
tree | e7c23fc427bb5066d11bb76b26d607f828cdbb6e | |
parent | removed debug (diff) | |
download | sway-cd0cdc28aa6578d0a8fb0a27c5dd07052320e734.tar.gz sway-cd0cdc28aa6578d0a8fb0a27c5dd07052320e734.tar.zst sway-cd0cdc28aa6578d0a8fb0a27c5dd07052320e734.zip |
fixed focus
-rw-r--r-- | sway/layout.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sway/layout.c b/sway/layout.c index 8b9315b4..66cbde99 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -223,16 +223,20 @@ 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 to %p", view); | 226 | sway_log(L_DEBUG, "Setting focus for %p", view); |
227 | if (view->type == C_VIEW) { | 227 | if (view == &root_container) { |
228 | wlc_view_set_state(view->handle, WLC_BIT_ACTIVATED, true); | 228 | // Propegate wayland focus down |
229 | wlc_view_bring_to_front(view->handle); | 229 | swayc_t *child = view->focused; |
230 | wlc_view_focus(view->handle); | 230 | while (child && child->type != C_VIEW) { |
231 | } | 231 | child = child->focused; |
232 | // Propagete focus up | 232 | } |
233 | while (view != &root_container) { | 233 | if (child) { |
234 | view->parent->focused = view; | 234 | wlc_view_set_state(child->handle, WLC_BIT_ACTIVATED, true); |
235 | view = view->parent; | 235 | wlc_view_focus(child->handle); |
236 | } | ||
237 | return; | ||
236 | } | 238 | } |
239 | view->parent->focused = view; | ||
240 | focus_view(view->parent); | ||
237 | } | 241 | } |
238 | 242 | ||