diff options
-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, | |||
162 | seat_set_focus_warp(cursor->seat, c, false); | 162 | seat_set_focus_warp(cursor->seat, c, false); |
163 | } | 163 | } |
164 | } else { | 164 | } else { |
165 | seat_set_focus_warp(cursor->seat, c, false); | 165 | // Don't switch focus on title mouseover for |
166 | // stacked and tabbed layouts | ||
167 | // If pointed container is in nested containers which are | ||
168 | // inside tabbed/stacked layout we should skip them | ||
169 | bool do_mouse_focus = true; | ||
170 | if(!sway_assert(c->type == C_VIEW, "pointed container is not a view")) { | ||
171 | return; | ||
172 | } | ||
173 | bool is_visible = view_is_visible(c->sway_view); | ||
174 | struct sway_container *p = c->parent; | ||
175 | while (p) { | ||
176 | if ((p->layout == L_TABBED || p->layout == L_STACKED) | ||
177 | && !is_visible) { | ||
178 | do_mouse_focus = false; | ||
179 | break; | ||
180 | } | ||
181 | p = p->parent; | ||
182 | } | ||
183 | if (!do_mouse_focus) { | ||
184 | struct sway_container *next_focus = seat_get_focus_inactive( | ||
185 | cursor->seat, p); | ||
186 | if(next_focus && !sway_assert(next_focus->type == C_VIEW, | ||
187 | "focus inactive container is not a view")) { | ||
188 | return; | ||
189 | } | ||
190 | if (next_focus && view_is_visible(next_focus->sway_view)) { | ||
191 | seat_set_focus_warp(cursor->seat, next_focus, false); | ||
192 | } | ||
193 | } else { | ||
194 | seat_set_focus_warp(cursor->seat, c, false); | ||
195 | } | ||
166 | } | 196 | } |
167 | } | 197 | } |
168 | 198 | ||