Rely on view_is_visible rather thank walking the tree ourselves.

master
Scott Leggett 7 years ago
parent 4cd304e4ba
commit dd86444e59

@ -171,24 +171,13 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
} }
} else if (c->type == C_VIEW) { } else if (c->type == C_VIEW) {
bool do_mouse_focus = true; bool do_mouse_focus = true;
bool is_visible = view_is_visible(c->sway_view); // Don't switch focus if either of the following is true:
struct sway_container *p = c->parent; // - the cursor is over the same container as before. i.e. hasn't crossed
// Don't switch focus unless we have moved from one container to another // a window boundary; or
if (c && c == prev_c) { // - 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; 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) { if (do_mouse_focus) {
seat_set_focus_warp(cursor->seat, c, false); seat_set_focus_warp(cursor->seat, c, false);
} else { } else {

Loading…
Cancel
Save