sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 0039f7a4fdaa6608911bd4f3c2dbcd06f24f99ec
parent dd86444e594138771d1e7edad69ac7007c500b63
Author: Scott Leggett <scott@sl.id.au>
Date:   Mon, 28 May 2018 01:30:19 +1000

Simplify logic, remove redundant variables.

Diffstat:
Msway/input/cursor.c | 13++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git 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, seat_set_focus_warp(cursor->seat, c, false); } } else if (c->type == C_VIEW) { - bool do_mouse_focus = true; - // Don't switch focus if either of the following is true: - // - the cursor is over the same container as before. i.e. hasn't crossed - // a window boundary; or - // - 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; - } - if (do_mouse_focus) { + // Focus c if both of the following are true: + // - cursor is over a new view, i.e. entered a new window; and + // - the new view is visible, i.e. not hidden in a stack or tab. + if (c != prev_c && view_is_visible(c->sway_view)) { seat_set_focus_warp(cursor->seat, c, false); } else { struct sway_container *next_focus =