sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 2aa6afae542b4cc25b48510e46abb82f85aca518
parent 26204441b40591415855d971f87f2bed511ccd7d
Author: Ryan Dwyer <ryandwyer1@gmail.com>
Date:   Fri, 31 Aug 2018 17:44:49 +1000

Fix mouse_warping

Diffstat:
Msway/input/seat.c | 21++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git 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, } if (config->mouse_warping && warp && new_output != last_output) { - double x = container->x + container->width / 2.0; - double y = container->y + container->height / 2.0; - if (!wlr_output_layout_contains_point(root->output_layout, - new_output->wlr_output, seat->cursor->cursor->x, - seat->cursor->cursor->y)) { - wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); - cursor_send_pointer_motion(seat->cursor, 0, true); + double x = 0; + double y = 0; + if (container) { + x = container->x + container->width / 2.0; + y = container->y + container->height / 2.0; + } 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)) { + wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); + cursor_send_pointer_motion(seat->cursor, 0, true); } } }