diff options
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index c7deabed..d8d2f3a4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -774,27 +774,18 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | |||
774 | workspace_consider_destroy(last_workspace); | 774 | workspace_consider_destroy(last_workspace); |
775 | } | 775 | } |
776 | 776 | ||
777 | if (last_focus) { | 777 | if (last_focus && warp) { |
778 | if (config->mouse_warping && warp && | 778 | if (container && config->mouse_warping == WARP_CONTAINER) { |
779 | (new_output != last_output || | 779 | cursor_warp_to_container(seat->cursor, container); |
780 | config->mouse_warping == WARP_CONTAINER)) { | 780 | cursor_send_pointer_motion(seat->cursor, 0, true); |
781 | double x = 0; | 781 | } else if (new_output != last_output && |
782 | double y = 0; | 782 | config->mouse_warping >= WARP_OUTPUT) { |
783 | if (container) { | 783 | if (container) { |
784 | x = container->x + container->width / 2.0; | 784 | cursor_warp_to_container(seat->cursor, container); |
785 | y = container->y + container->height / 2.0; | ||
786 | } else { | 785 | } else { |
787 | x = new_workspace->x + new_workspace->width / 2.0; | 786 | cursor_warp_to_workspace(seat->cursor, new_workspace); |
788 | y = new_workspace->y + new_workspace->height / 2.0; | ||
789 | } | ||
790 | |||
791 | if (!wlr_output_layout_contains_point(root->output_layout, | ||
792 | new_output->wlr_output, seat->cursor->cursor->x, | ||
793 | seat->cursor->cursor->y) | ||
794 | || config->mouse_warping == WARP_CONTAINER) { | ||
795 | wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); | ||
796 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
797 | } | 787 | } |
788 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
798 | } | 789 | } |
799 | } | 790 | } |
800 | 791 | ||