sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 1531eb317110e4e1358f203b0ce114f67a10b5d8
parent 213e740c7f58e7629b47ee8f916cb51fbe8c62dc
Author: Ryan Dwyer <RyanDwyer@users.noreply.github.com>
Date:   Sat, 26 May 2018 23:56:59 +1000

Merge pull request #2030 from chebykinn/fix-focus-follows-mouse-tabs

Don't focus tabbed and stacked containers on mouseover
Diffstat:
Msway/input/cursor.c | 32+++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)

diff --git 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); + } } }