diff options
author | 2018-05-20 16:05:53 -0400 | |
---|---|---|
committer | 2018-05-20 16:05:53 -0400 | |
commit | cf3ab1f45f29c62768975d64f38a7734372e4999 (patch) | |
tree | fabc0987827fe481fb4c48ca45ab9ca1921fca8b /sway | |
parent | Merge pull request #2010 from RedSoxFan/premultiply-alpha (diff) | |
parent | Merge branch 'master' into fix-focus-follows-mouse (diff) | |
download | sway-cf3ab1f45f29c62768975d64f38a7734372e4999.tar.gz sway-cf3ab1f45f29c62768975d64f38a7734372e4999.tar.zst sway-cf3ab1f45f29c62768975d64f38a7734372e4999.zip |
Merge pull request #2007 from swaywm/fix-focus-follows-mouse
Fix focus_follows_mouse over swaybar
Diffstat (limited to 'sway')
-rw-r--r-- | sway/input/cursor.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 9259c475..3a73954c 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -146,7 +146,23 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec) | |||
146 | struct sway_container *c = container_at_coords(cursor->seat, | 146 | struct sway_container *c = container_at_coords(cursor->seat, |
147 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | 147 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); |
148 | if (c && config->focus_follows_mouse) { | 148 | if (c && config->focus_follows_mouse) { |
149 | seat_set_focus_warp(cursor->seat, c, false); | 149 | if (c->type == C_WORKSPACE) { |
150 | // Only follow the mouse if it would move to a new output | ||
151 | // Otherwise we'll focus the workspace, which is probably wrong | ||
152 | struct sway_container *focus = seat_get_focus(cursor->seat); | ||
153 | if (focus->type != C_OUTPUT) { | ||
154 | focus = container_parent(focus, C_OUTPUT); | ||
155 | } | ||
156 | struct sway_container *output = c; | ||
157 | if (output->type != C_OUTPUT) { | ||
158 | output = container_parent(c, C_OUTPUT); | ||
159 | } | ||
160 | if (output != focus) { | ||
161 | seat_set_focus_warp(cursor->seat, c, false); | ||
162 | } | ||
163 | } else { | ||
164 | seat_set_focus_warp(cursor->seat, c, false); | ||
165 | } | ||
150 | } | 166 | } |
151 | 167 | ||
152 | // reset cursor if switching between clients | 168 | // reset cursor if switching between clients |