diff options
author | Scott Leggett <scott@sl.id.au> | 2018-05-28 01:17:31 +1000 |
---|---|---|
committer | Scott Leggett <scott@sl.id.au> | 2018-05-28 01:38:46 +1000 |
commit | dd86444e594138771d1e7edad69ac7007c500b63 (patch) | |
tree | 5c0dbdd1da80d680f343ce7484fb5f62a0efaf34 /sway | |
parent | 4cd304e4bacb255694bf63f8f1ccacd352a96144 (diff) |
Rely on view_is_visible rather thank walking the tree ourselves.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/input/cursor.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index a318bbd4..42eb2810 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -171,24 +171,13 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, } } else if (c->type == C_VIEW) { bool do_mouse_focus = true; - bool is_visible = view_is_visible(c->sway_view); - struct sway_container *p = c->parent; - // Don't switch focus unless we have moved from one container to another - if (c && c == prev_c) { + // Don't switch focus if either of the following is true: + // - the cursor is over the same container as before. i.e. hasn't crossed + // a window boundary; or + // - the view is not visible. i.e. in a stack or tab. + if (c == prev_c || !view_is_visible(c->sway_view)) { do_mouse_focus = 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 - if (do_mouse_focus && !is_visible) { - while (p) { - if ((p->layout == L_TABBED || p->layout == L_STACKED)) { - do_mouse_focus = false; - break; - } - p = p->parent; - } - } if (do_mouse_focus) { seat_set_focus_warp(cursor->seat, c, false); } else { |