diff options
-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, | |||
171 | } | 171 | } |
172 | } else if (c->type == C_VIEW) { | 172 | } else if (c->type == C_VIEW) { |
173 | bool do_mouse_focus = true; | 173 | bool do_mouse_focus = true; |
174 | bool is_visible = view_is_visible(c->sway_view); | 174 | // Don't switch focus if either of the following is true: |
175 | struct sway_container *p = c->parent; | 175 | // - the cursor is over the same container as before. i.e. hasn't crossed |
176 | // Don't switch focus unless we have moved from one container to another | 176 | // a window boundary; or |
177 | if (c && c == prev_c) { | 177 | // - the view is not visible. i.e. in a stack or tab. |
178 | if (c == prev_c || !view_is_visible(c->sway_view)) { | ||
178 | do_mouse_focus = false; | 179 | do_mouse_focus = false; |
179 | } | 180 | } |
180 | // Don't switch focus on title mouseover for stacked and tabbed layouts | ||
181 | // If pointed container is in nested containers which are inside | ||
182 | // tabbed/stacked layout we should skip them | ||
183 | if (do_mouse_focus && !is_visible) { | ||
184 | while (p) { | ||
185 | if ((p->layout == L_TABBED || p->layout == L_STACKED)) { | ||
186 | do_mouse_focus = false; | ||
187 | break; | ||
188 | } | ||
189 | p = p->parent; | ||
190 | } | ||
191 | } | ||
192 | if (do_mouse_focus) { | 181 | if (do_mouse_focus) { |
193 | seat_set_focus_warp(cursor->seat, c, false); | 182 | seat_set_focus_warp(cursor->seat, c, false); |
194 | } else { | 183 | } else { |