diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-31 17:44:49 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-05 18:01:43 +1000 |
commit | 2aa6afae542b4cc25b48510e46abb82f85aca518 (patch) | |
tree | ed17118acaf84340d94f75941c3ba64b49a0d397 | |
parent | Apply default config to output (diff) | |
download | sway-2aa6afae542b4cc25b48510e46abb82f85aca518.tar.gz sway-2aa6afae542b4cc25b48510e46abb82f85aca518.tar.zst sway-2aa6afae542b4cc25b48510e46abb82f85aca518.zip |
Fix mouse_warping
-rw-r--r-- | sway/input/seat.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 2f7a3318..feb98cd4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -709,13 +709,20 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | |||
709 | } | 709 | } |
710 | 710 | ||
711 | if (config->mouse_warping && warp && new_output != last_output) { | 711 | if (config->mouse_warping && warp && new_output != last_output) { |
712 | double x = container->x + container->width / 2.0; | 712 | double x = 0; |
713 | double y = container->y + container->height / 2.0; | 713 | double y = 0; |
714 | if (!wlr_output_layout_contains_point(root->output_layout, | 714 | if (container) { |
715 | new_output->wlr_output, seat->cursor->cursor->x, | 715 | x = container->x + container->width / 2.0; |
716 | seat->cursor->cursor->y)) { | 716 | y = container->y + container->height / 2.0; |
717 | wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); | 717 | } else { |
718 | cursor_send_pointer_motion(seat->cursor, 0, true); | 718 | x = new_workspace->x + new_workspace->width / 2.0; |
719 | y = new_workspace->y + new_workspace->height / 2.0; | ||
720 | } | ||
721 | if (!wlr_output_layout_contains_point(root->output_layout, | ||
722 | new_output->wlr_output, seat->cursor->cursor->x, | ||
723 | seat->cursor->cursor->y)) { | ||
724 | wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); | ||
725 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
719 | } | 726 | } |
720 | } | 727 | } |
721 | } | 728 | } |