diff options
author | Rouven Czerwinski <rouven@czerwinskis.de> | 2018-10-15 16:20:18 +0200 |
---|---|---|
committer | Rouven Czerwinski <rouven@czerwinskis.de> | 2018-10-16 15:47:02 +0200 |
commit | d69cf4c23c437b9ff724869f380e5c6cd03b091e (patch) | |
tree | b3a6a902ac793a25b956a6dc93ede524599150c1 /sway/input/seat.c | |
parent | cursor: functions to warp cursor to container and workspace (diff) | |
download | sway-d69cf4c23c437b9ff724869f380e5c6cd03b091e.tar.gz sway-d69cf4c23c437b9ff724869f380e5c6cd03b091e.tar.zst sway-d69cf4c23c437b9ff724869f380e5c6cd03b091e.zip |
seat: use new warping functions for cursor warping during focus warp
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 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, | |||
771 | workspace_consider_destroy(last_workspace); | 771 | workspace_consider_destroy(last_workspace); |
772 | } | 772 | } |
773 | 773 | ||
774 | if (last_focus) { | 774 | if (last_focus && warp) { |
775 | if (config->mouse_warping && warp && | 775 | if (container && config->mouse_warping == WARP_CONTAINER) { |
776 | (new_output != last_output || | 776 | cursor_warp_to_container(seat->cursor, container); |
777 | config->mouse_warping == WARP_CONTAINER)) { | 777 | cursor_send_pointer_motion(seat->cursor, 0, true); |
778 | double x = 0; | 778 | } else if (new_output != last_output && |
779 | double y = 0; | 779 | config->mouse_warping >= WARP_OUTPUT) { |
780 | if (container) { | 780 | if (container) { |
781 | x = container->x + container->width / 2.0; | 781 | cursor_warp_to_container(seat->cursor, container); |
782 | y = container->y + container->height / 2.0; | ||
783 | } else { | 782 | } else { |
784 | x = new_workspace->x + new_workspace->width / 2.0; | 783 | cursor_warp_to_workspace(seat->cursor, new_workspace); |
785 | y = new_workspace->y + new_workspace->height / 2.0; | ||
786 | } | ||
787 | |||
788 | if (!wlr_output_layout_contains_point(root->output_layout, | ||
789 | new_output->wlr_output, seat->cursor->cursor->x, | ||
790 | seat->cursor->cursor->y) | ||
791 | || config->mouse_warping == WARP_CONTAINER) { | ||
792 | wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); | ||
793 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
794 | } | 784 | } |
785 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
795 | } | 786 | } |
796 | } | 787 | } |
797 | 788 | ||