diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-05-26 23:56:59 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-26 23:56:59 +1000 |
commit | 1531eb317110e4e1358f203b0ce114f67a10b5d8 (patch) | |
tree | b181557473fce4ba220c397984870a913417e71d | |
parent | 213e740c7f58e7629b47ee8f916cb51fbe8c62dc (diff) | |
parent | 30c0653b8709ff838fb096a02426d600668488da (diff) | |
download | sway-1531eb317110e4e1358f203b0ce114f67a10b5d8.tar.xz |
Merge pull request #2030 from chebykinn/fix-focus-follows-mouse-tabs
Don't focus tabbed and stacked containers on mouseover
-rw-r--r-- | sway/input/cursor.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 9a0b4f01..98780989 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -162,7 +162,37 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, seat_set_focus_warp(cursor->seat, c, false); } } else { - seat_set_focus_warp(cursor->seat, c, false); + // Don't switch focus on title mouseover for + // stacked and tabbed layouts + // If pointed container is in nested containers which are + // inside tabbed/stacked layout we should skip them + bool do_mouse_focus = true; + if(!sway_assert(c->type == C_VIEW, "pointed container is not a view")) { + return; + } + bool is_visible = view_is_visible(c->sway_view); + struct sway_container *p = c->parent; + while (p) { + if ((p->layout == L_TABBED || p->layout == L_STACKED) + && !is_visible) { + do_mouse_focus = false; + break; + } + p = p->parent; + } + if (!do_mouse_focus) { + struct sway_container *next_focus = seat_get_focus_inactive( + cursor->seat, p); + if(next_focus && !sway_assert(next_focus->type == C_VIEW, + "focus inactive container is not a view")) { + return; + } + if (next_focus && view_is_visible(next_focus->sway_view)) { + seat_set_focus_warp(cursor->seat, next_focus, false); + } + } else { + seat_set_focus_warp(cursor->seat, c, false); + } } } |