From 41991542cac1d909a55fc834d231fe747097b1a4 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Wed, 10 Oct 2018 11:28:37 +0200 Subject: Add mouse_warping container This option always moves the cursor into the middle of the container if the warp variable is true in seat_set_focus_warp. Fixes #2577 --- sway/input/seat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sway/input') diff --git a/sway/input/seat.c b/sway/input/seat.c index f418785d..7508d6b9 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -772,7 +772,9 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, } if (last_focus) { - if (config->mouse_warping && warp && new_output != last_output) { + if (config->mouse_warping && warp && + (new_output != last_output || + config->mouse_warping == WARP_CONTAINER)) { double x = 0; double y = 0; if (container) { @@ -782,9 +784,11 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, 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)) { + 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); } -- cgit v1.2.3