Consider cursor warp when switching workspaces

Fixes a regression introduced in
24a90e5d86.

consider_warp_to_focus has been renamed to seat_consider_warp_to_focus,
moved to seat.c and made public. It is now called when switching
workspaces via `workspace <ws>`.
This commit is contained in:
Ryan Dwyer 2018-10-19 07:57:50 +10:00
parent 30dbb8eba0
commit a2fdac2c4b
4 changed files with 27 additions and 24 deletions

View file

@ -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);
}