diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-19 14:40:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 14:40:56 +0200 |
commit | 28f3b8cb038d54eeef5c6fe568b0ae360b59f96e (patch) | |
tree | 60a0dbb15a7ecc160bff46acec7aead1ca06ae54 | |
parent | Merge pull request #2875 from RedSoxFan/input-device-bindings (diff) | |
parent | Fix logic used for mouse_warping output (diff) | |
download | sway-28f3b8cb038d54eeef5c6fe568b0ae360b59f96e.tar.gz sway-28f3b8cb038d54eeef5c6fe568b0ae360b59f96e.tar.zst sway-28f3b8cb038d54eeef5c6fe568b0ae360b59f96e.zip |
Merge pull request #2882 from RyanDwyer/fix-mouse-warp-logic
Fix logic used for mouse_warping output
-rw-r--r-- | include/sway/input/seat.h | 1 | ||||
-rw-r--r-- | sway/input/seat.c | 14 |
2 files changed, 9 insertions, 6 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index eb0d1a02..e9f553f3 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -52,7 +52,6 @@ struct sway_seat { | |||
52 | bool has_focus; | 52 | bool has_focus; |
53 | struct wl_list focus_stack; // list of containers in focus order | 53 | struct wl_list focus_stack; // list of containers in focus order |
54 | struct sway_workspace *workspace; | 54 | struct sway_workspace *workspace; |
55 | struct sway_node *prev_focus; | ||
56 | 55 | ||
57 | // If the focused layer is set, views cannot receive keyboard focus | 56 | // If the focused layer is set, views cannot receive keyboard focus |
58 | struct wlr_layer_surface_v1 *focused_layer; | 57 | struct wlr_layer_surface_v1 *focused_layer; |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 08b2e7cf..cffceaae 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -646,7 +646,6 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { | |||
646 | } | 646 | } |
647 | 647 | ||
648 | struct sway_node *last_focus = seat_get_focus(seat); | 648 | struct sway_node *last_focus = seat_get_focus(seat); |
649 | seat->prev_focus = last_focus; | ||
650 | if (last_focus == node) { | 649 | if (last_focus == node) { |
651 | return; | 650 | return; |
652 | } | 651 | } |
@@ -1190,12 +1189,17 @@ void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | |||
1190 | 1189 | ||
1191 | void seat_consider_warp_to_focus(struct sway_seat *seat) { | 1190 | void seat_consider_warp_to_focus(struct sway_seat *seat) { |
1192 | struct sway_node *focus = seat_get_focus(seat); | 1191 | struct sway_node *focus = seat_get_focus(seat); |
1193 | if (config->mouse_warping == WARP_NO || !focus || !seat->prev_focus) { | 1192 | if (config->mouse_warping == WARP_NO || !focus) { |
1194 | return; | 1193 | return; |
1195 | } | 1194 | } |
1196 | if (config->mouse_warping == WARP_OUTPUT && | 1195 | if (config->mouse_warping == WARP_OUTPUT) { |
1197 | node_get_output(focus) == node_get_output(seat->prev_focus)) { | 1196 | struct sway_output *output = node_get_output(focus); |
1198 | return; | 1197 | struct wlr_box box; |
1198 | output_get_box(output, &box); | ||
1199 | if (wlr_box_contains_point(&box, | ||
1200 | seat->cursor->cursor->x, seat->cursor->cursor->y)) { | ||
1201 | return; | ||
1202 | } | ||
1199 | } | 1203 | } |
1200 | 1204 | ||
1201 | if (focus->type == N_CONTAINER) { | 1205 | if (focus->type == N_CONTAINER) { |