diff options
author | 2018-05-25 15:37:06 +0300 | |
---|---|---|
committer | 2018-05-25 16:54:43 +0300 | |
commit | 3b672533128d5ff7233e26603d52277abfd6724a (patch) | |
tree | 55e670e3ff0cd94d427161e16a4c8613697c4a1a /sway | |
parent | Implement correct focusing for tabbed containers (diff) | |
download | sway-3b672533128d5ff7233e26603d52277abfd6724a.tar.gz sway-3b672533128d5ff7233e26603d52277abfd6724a.tar.zst sway-3b672533128d5ff7233e26603d52277abfd6724a.zip |
Skip all nested containers
Diffstat (limited to 'sway')
-rw-r--r-- | sway/input/cursor.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 564c7763..4b15e0e2 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -167,23 +167,19 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | |||
167 | bool is_below_title = | 167 | bool is_below_title = |
168 | c_local_y - container_titlebar_height() > 0.001; | 168 | c_local_y - container_titlebar_height() > 0.001; |
169 | 169 | ||
170 | // Don't switch focus on title mouseover for | ||
171 | // stacked and tabbed layouts | ||
172 | // If pointed container is in nested containers which are | ||
173 | // inside tabbed/stacked layout we should skip them | ||
170 | bool do_mouse_focus = true; | 174 | bool do_mouse_focus = true; |
171 | 175 | struct sway_container *p = c->parent; | |
172 | // Don't switch focus on title mouseover for stacked and tabbed | 176 | while(p) { |
173 | // layouts | 177 | if((p->layout == L_TABBED || p->layout == L_STACKED) |
174 | if(c->parent && (c->parent->layout == L_STACKED | 178 | && !is_below_title) { |
175 | || c->parent->layout == L_TABBED) | 179 | do_mouse_focus = false; |
176 | && !is_below_title) { | 180 | break; |
177 | do_mouse_focus = false; | 181 | } |
178 | } | 182 | p = p->parent; |
179 | |||
180 | // If pointed container is in nested container | ||
181 | // inside tabbed/stacked layout we should skip this nested container | ||
182 | if(c->parent && c->parent->parent && | ||
183 | (c->parent->parent->layout == L_STACKED | ||
184 | || c->parent->parent->layout == L_TABBED) | ||
185 | && !is_below_title) { | ||
186 | do_mouse_focus = false; | ||
187 | } | 183 | } |
188 | 184 | ||
189 | if(do_mouse_focus) { | 185 | if(do_mouse_focus) { |