diff options
author | Rouven Czerwinski <rouven@czerwinskis.de> | 2018-10-10 11:28:37 +0200 |
---|---|---|
committer | Rouven Czerwinski <rouven@czerwinskis.de> | 2018-10-10 12:45:21 +0200 |
commit | 41991542cac1d909a55fc834d231fe747097b1a4 (patch) | |
tree | 0e0eba7984d8e98b70c29159a2792ec1e39b9351 /sway/input/seat.c | |
parent | Merge pull request #2812 from RyanDwyer/fix-version-messages (diff) | |
download | sway-41991542cac1d909a55fc834d231fe747097b1a4.tar.gz sway-41991542cac1d909a55fc834d231fe747097b1a4.tar.zst sway-41991542cac1d909a55fc834d231fe747097b1a4.zip |
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
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 8 |
1 files changed, 6 insertions, 2 deletions
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, | |||
772 | } | 772 | } |
773 | 773 | ||
774 | if (last_focus) { | 774 | if (last_focus) { |
775 | if (config->mouse_warping && warp && new_output != last_output) { | 775 | if (config->mouse_warping && warp && |
776 | (new_output != last_output || | ||
777 | config->mouse_warping == WARP_CONTAINER)) { | ||
776 | double x = 0; | 778 | double x = 0; |
777 | double y = 0; | 779 | double y = 0; |
778 | if (container) { | 780 | if (container) { |
@@ -782,9 +784,11 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | |||
782 | x = new_workspace->x + new_workspace->width / 2.0; | 784 | x = new_workspace->x + new_workspace->width / 2.0; |
783 | y = new_workspace->y + new_workspace->height / 2.0; | 785 | y = new_workspace->y + new_workspace->height / 2.0; |
784 | } | 786 | } |
787 | |||
785 | if (!wlr_output_layout_contains_point(root->output_layout, | 788 | if (!wlr_output_layout_contains_point(root->output_layout, |
786 | new_output->wlr_output, seat->cursor->cursor->x, | 789 | new_output->wlr_output, seat->cursor->cursor->x, |
787 | seat->cursor->cursor->y)) { | 790 | seat->cursor->cursor->y) |
791 | || config->mouse_warping == WARP_CONTAINER) { | ||
788 | wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); | 792 | wlr_cursor_warp(seat->cursor->cursor, NULL, x, y); |
789 | cursor_send_pointer_motion(seat->cursor, 0, true); | 793 | cursor_send_pointer_motion(seat->cursor, 0, true); |
790 | } | 794 | } |