diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index e526d816..8c239bd7 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -879,9 +879,11 @@ tp_gesture_handle_state_none(struct tp_dispatch *tp, uint64_t time) } static void -tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time) +tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time, + bool ignore_motion) { - tp_gesture_detect_motion_gestures(tp, time); + if (!ignore_motion) + tp_gesture_detect_motion_gestures(tp, time); } static void @@ -983,13 +985,14 @@ tp_gesture_handle_state_pinch(struct tp_dispatch *tp, uint64_t time) } static void -tp_gesture_post_gesture(struct tp_dispatch *tp, uint64_t time) +tp_gesture_post_gesture(struct tp_dispatch *tp, uint64_t time, + bool ignore_motion) { if (tp->gesture.state == GESTURE_STATE_NONE) tp_gesture_handle_state_none(tp, time); if (tp->gesture.state == GESTURE_STATE_UNKNOWN) - tp_gesture_handle_state_unknown(tp, time); + tp_gesture_handle_state_unknown(tp, time, ignore_motion); if (tp->gesture.state == GESTURE_STATE_POINTER_MOTION) tp_gesture_handle_state_pointer_motion(tp, time); @@ -1021,7 +1024,8 @@ tp_gesture_thumb_moved(struct tp_dispatch *tp) } void -tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) +tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time, + bool ignore_motion) { if (tp->gesture.finger_count == 0) return; @@ -1055,7 +1059,7 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) tp_thumb_reset(tp); if (tp->gesture.finger_count <= 4) - tp_gesture_post_gesture(tp, time); + tp_gesture_post_gesture(tp, time, ignore_motion); } void diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 102802d0..40e4b71f 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -1866,18 +1866,23 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) ignore_motion |= tp_tap_handle_state(tp, time); ignore_motion |= tp_post_button_events(tp, time); - if (ignore_motion || - tp->palm.trackpoint_active || - tp->dwt.keyboard_active) { + if (tp->palm.trackpoint_active || tp->dwt.keyboard_active) { tp_edge_scroll_stop_events(tp, time); tp_gesture_cancel(tp, time); return; } + if (ignore_motion) { + tp_edge_scroll_stop_events(tp, time); + tp_gesture_cancel(tp, time); + tp_gesture_post_events(tp, time, true); + return; + } + if (tp_edge_scroll_post_events(tp, time) != 0) return; - tp_gesture_post_events(tp, time); + tp_gesture_post_events(tp, time, false); } static void diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 46e73573..a58ca7f7 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -703,7 +703,8 @@ void tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time); void -tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time); +tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time, + bool ignore_motion); void tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time);