diff options
author | 2018-10-19 02:49:13 +0200 | |
---|---|---|
committer | 2018-10-19 02:49:13 +0200 | |
commit | 19adc3ff2dc262ade0bc1a87895e49696224d5d0 (patch) | |
tree | cc3e83eae5042db2ca75b063413d4d8403e79a7a /sway/input/seat.c | |
parent | Merge pull request #2874 from ianyfan/swaybar (diff) | |
parent | Consider cursor warp when switching workspaces (diff) | |
download | sway-19adc3ff2dc262ade0bc1a87895e49696224d5d0.tar.gz sway-19adc3ff2dc262ade0bc1a87895e49696224d5d0.tar.zst sway-19adc3ff2dc262ade0bc1a87895e49696224d5d0.zip |
Merge pull request #2877 from RyanDwyer/warp-on-workspace-switch
Consider cursor warp when switching workspaces
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 60ee27d0..08b2e7cf 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1187,3 +1187,21 @@ void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | |||
1187 | seat->last_button_serial = wlr_seat_pointer_notify_button(seat->wlr_seat, | 1187 | seat->last_button_serial = wlr_seat_pointer_notify_button(seat->wlr_seat, |
1188 | time_msec, button, state); | 1188 | time_msec, button, state); |
1189 | } | 1189 | } |
1190 | |||
1191 | void seat_consider_warp_to_focus(struct sway_seat *seat) { | ||
1192 | struct sway_node *focus = seat_get_focus(seat); | ||
1193 | if (config->mouse_warping == WARP_NO || !focus || !seat->prev_focus) { | ||
1194 | return; | ||
1195 | } | ||
1196 | if (config->mouse_warping == WARP_OUTPUT && | ||
1197 | node_get_output(focus) == node_get_output(seat->prev_focus)) { | ||
1198 | return; | ||
1199 | } | ||
1200 | |||
1201 | if (focus->type == N_CONTAINER) { | ||
1202 | cursor_warp_to_container(seat->cursor, focus->sway_container); | ||
1203 | } else { | ||
1204 | cursor_warp_to_workspace(seat->cursor, focus->sway_workspace); | ||
1205 | } | ||
1206 | cursor_send_pointer_motion(seat->cursor, 0, false); | ||
1207 | } | ||