aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Scott Leggett <scott@sl.id.au>2018-05-28 01:30:19 +1000
committerLibravatar Scott Leggett <scott@sl.id.au>2018-05-28 01:38:46 +1000
commit0039f7a4fdaa6608911bd4f3c2dbcd06f24f99ec (patch)
tree276a0ba87232cec9f09e1acf1c0a9b6143da8ad0 /sway/input/cursor.c
parentRely on view_is_visible rather thank walking the tree ourselves. (diff)
downloadsway-0039f7a4fdaa6608911bd4f3c2dbcd06f24f99ec.tar.gz
sway-0039f7a4fdaa6608911bd4f3c2dbcd06f24f99ec.tar.zst
sway-0039f7a4fdaa6608911bd4f3c2dbcd06f24f99ec.zip
Simplify logic, remove redundant variables.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 42eb2810..1fa5be34 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -170,15 +170,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
170 seat_set_focus_warp(cursor->seat, c, false); 170 seat_set_focus_warp(cursor->seat, c, false);
171 } 171 }
172 } else if (c->type == C_VIEW) { 172 } else if (c->type == C_VIEW) {
173 bool do_mouse_focus = true; 173 // Focus c if both of the following are true:
174 // Don't switch focus if either of the following is true: 174 // - cursor is over a new view, i.e. entered a new window; and
175 // - the cursor is over the same container as before. i.e. hasn't crossed 175 // - the new view is visible, i.e. not hidden in a stack or tab.
176 // a window boundary; or 176 if (c != prev_c && view_is_visible(c->sway_view)) {
177 // - the view is not visible. i.e. in a stack or tab.
178 if (c == prev_c || !view_is_visible(c->sway_view)) {
179 do_mouse_focus = false;
180 }
181 if (do_mouse_focus) {
182 seat_set_focus_warp(cursor->seat, c, false); 177 seat_set_focus_warp(cursor->seat, c, false);
183 } else { 178 } else {
184 struct sway_container *next_focus = 179 struct sway_container *next_focus =