diff options
author | Simon Ser <contact@emersion.fr> | 2021-07-10 14:02:20 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-07-26 16:58:11 +0200 |
commit | 2e03a61262746b882e82033914afae950a9fa2b2 (patch) | |
tree | c7f7432dd647bc0c6f06389dd3d42d6e2a28ed7b /sway/input/cursor.c | |
parent | Fix crash when starting without HOME (diff) | |
download | sway-2e03a61262746b882e82033914afae950a9fa2b2.tar.gz sway-2e03a61262746b882e82033914afae950a9fa2b2.tar.zst sway-2e03a61262746b882e82033914afae950a9fa2b2.zip |
Fix wl_pointer.frame not sent on touch emulation
When emulating touch, the simulating_pointer_from_touch field is
set to true. It's switched back to false when a touch_up event is
received. However we need to ensure we always send a wl_pointer.frame
event following a group of other wl_pointer events.
Since a touch_frame event is always guaranteed to come after a group
of touch events, unset simulating_pointer_from_touch in the touch_frame
handler instead of the touch_up handler. Add a new field to know whether
the touch_frame handler should stop emulation.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 96b5b935..2fe5b202 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -507,7 +507,7 @@ static void handle_touch_up(struct wl_listener *listener, void *data) { | |||
507 | 507 | ||
508 | if (cursor->simulating_pointer_from_touch) { | 508 | if (cursor->simulating_pointer_from_touch) { |
509 | if (cursor->pointer_touch_id == cursor->seat->touch_id) { | 509 | if (cursor->pointer_touch_id == cursor->seat->touch_id) { |
510 | cursor->simulating_pointer_from_touch = false; | 510 | cursor->pointer_touch_up = true; |
511 | dispatch_cursor_button(cursor, event->device, event->time_msec, | 511 | dispatch_cursor_button(cursor, event->device, event->time_msec, |
512 | BTN_LEFT, WLR_BUTTON_RELEASED); | 512 | BTN_LEFT, WLR_BUTTON_RELEASED); |
513 | } | 513 | } |
@@ -565,6 +565,11 @@ static void handle_touch_frame(struct wl_listener *listener, void *data) { | |||
565 | 565 | ||
566 | if (cursor->simulating_pointer_from_touch) { | 566 | if (cursor->simulating_pointer_from_touch) { |
567 | wlr_seat_pointer_notify_frame(wlr_seat); | 567 | wlr_seat_pointer_notify_frame(wlr_seat); |
568 | |||
569 | if (cursor->pointer_touch_up) { | ||
570 | cursor->pointer_touch_up = false; | ||
571 | cursor->simulating_pointer_from_touch = false; | ||
572 | } | ||
568 | } else { | 573 | } else { |
569 | wlr_seat_touch_notify_frame(wlr_seat); | 574 | wlr_seat_touch_notify_frame(wlr_seat); |
570 | } | 575 | } |