From d69cf4c23c437b9ff724869f380e5c6cd03b091e Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Mon, 15 Oct 2018 16:20:18 +0200 Subject: seat: use new warping functions for cursor warping during focus warp --- sway/input/seat.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'sway/input/seat.c') diff --git a/sway/input/seat.c b/sway/input/seat.c index 03ed638e..23f582ca 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -771,27 +771,18 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, workspace_consider_destroy(last_workspace); } - if (last_focus) { - if (config->mouse_warping && warp && - (new_output != last_output || - config->mouse_warping == WARP_CONTAINER)) { - double x = 0; - double y = 0; + if (last_focus && warp) { + if (container && config->mouse_warping == WARP_CONTAINER) { + cursor_warp_to_container(seat->cursor, container); + cursor_send_pointer_motion(seat->cursor, 0, true); + } else if (new_output != last_output && + config->mouse_warping >= WARP_OUTPUT) { if (container) { - x = container->x + container->width / 2.0; - y = container->y + container->height / 2.0; + cursor_warp_to_container(seat->cursor, container); } else { - x = new_workspace->x + new_workspace->width / 2.0; - y = new_workspace->y + new_workspace->height / 2.0; - } - - if (!wlr_output_layout_contains_point(root->output_layout, - new_output->wlr_output, seat->cursor->cursor->x, - seat->cursor->cursor->y) - || config->mouse_warping == WARP_CONTAINER) { - wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); - cursor_send_pointer_motion(seat->cursor, 0, true); + cursor_warp_to_workspace(seat->cursor, new_workspace); } + cursor_send_pointer_motion(seat->cursor, 0, true); } } -- cgit v1.2.3-54-g00ecf