aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-10-19 02:49:13 +0200
committerGitHub <noreply@github.com>2018-10-19 02:49:13 +0200
commit19adc3ff2dc262ade0bc1a87895e49696224d5d0 (patch)
treecc3e83eae5042db2ca75b063413d4d8403e79a7a /sway/input
parent30dbb8eba053fda2e17678feb6cebffc424e1e57 (diff)
parenta2fdac2c4b81b6da95b914a5f65fb297cb8d4ce4 (diff)
downloadsway-19adc3ff2dc262ade0bc1a87895e49696224d5d0.tar.xz
Merge pull request #2877 from RyanDwyer/warp-on-workspace-switch
Consider cursor warp when switching workspaces
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seat.c18
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,
seat->last_button_serial = wlr_seat_pointer_notify_button(seat->wlr_seat,
time_msec, button, state);
}
+
+void seat_consider_warp_to_focus(struct sway_seat *seat) {
+ struct sway_node *focus = seat_get_focus(seat);
+ if (config->mouse_warping == WARP_NO || !focus || !seat->prev_focus) {
+ return;
+ }
+ if (config->mouse_warping == WARP_OUTPUT &&
+ node_get_output(focus) == node_get_output(seat->prev_focus)) {
+ return;
+ }
+
+ if (focus->type == N_CONTAINER) {
+ cursor_warp_to_container(seat->cursor, focus->sway_container);
+ } else {
+ cursor_warp_to_workspace(seat->cursor, focus->sway_workspace);
+ }
+ cursor_send_pointer_motion(seat->cursor, 0, false);
+}