summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-15 08:34:09 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-15 08:34:09 -0700
commitf3a970e24e45ede4671217b4508268dec2314b20 (patch)
treea1ac021068764e9c876a04f5c350fb44037a9129
parentfixed focus (diff)
downloadsway-f3a970e24e45ede4671217b4508268dec2314b20.tar.gz
sway-f3a970e24e45ede4671217b4508268dec2314b20.tar.zst
sway-f3a970e24e45ede4671217b4508268dec2314b20.zip
fixed focus
-rw-r--r--sway/layout.c25
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
225void focus_view(swayc_t *view) { 225void 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