From: Alexander Mikhaylenko Date: Mon, 1 Mar 2021 16:09:37 +0000 (+0500) Subject: gestures: Filter unaccelerated deltas for gestures X-Git-Tag: 1.17.901~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60d5172e15728cc25db889a7a6bcf37a06a15a3a;p=platform%2Fupstream%2Flibinput.git gestures: Filter unaccelerated deltas for gestures Make sure the unaccelerated deltas are comparable to scroll deltas. edit by whot: The original intention of the unaccelerated motion data here was to provide both accelerated and unaccelerated motion for gestures so it was possible to have 1:1 mapping from gesture motion to screen activity. Normalizing to 1000dpi this way would've worked for mice but touchpad acceleration also includes the TP_MAGIC_SLOWDOWN (amongst other tricks) which slows down motion to around 27% *before* applying the acceleration function. On a 1000dpi touchpad (~40 units/mm) simply normalizing touchpad motion to 1000dpi results in pointer motion that is way too fast, it's lacking that slowdown to 27% of original speed. This results in the accelerated and unaccelerated gesture data being in effectively two different coordinate systems with the caller having no ability to relate the two. Switching to the special constant acceleration applies that slowdown and matches the data to the part of the acceleration curve where no (additional) acceleration is applied. It makes the gesture unaccelerated data comparable to the accelerated data and to scroll data which uses the same process. Fixes #582 Signed-off-by: Alexander Mikhaylenko Signed-off-by: Peter Hutterer --- diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 22392f7..c50fa96 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -636,7 +636,7 @@ tp_gesture_handle_state_swipe(struct tp_dispatch *tp, uint64_t time) delta = tp_filter_motion(tp, &raw, time); if (!normalized_is_zero(delta) || !device_float_is_zero(raw)) { - unaccel = tp_normalize_delta(tp, raw); + unaccel = tp_filter_motion_unaccelerated(tp, &raw, time); tp_gesture_start(tp, time); gesture_notify_swipe(&tp->device->base, time, LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, @@ -674,7 +674,7 @@ tp_gesture_handle_state_pinch(struct tp_dispatch *tp, uint64_t time) scale == tp->gesture.prev_scale && angle_delta == 0.0) return GESTURE_STATE_PINCH; - unaccel = tp_normalize_delta(tp, fdelta); + unaccel = tp_filter_motion_unaccelerated(tp, &fdelta, time); tp_gesture_start(tp, time); gesture_notify_pinch(&tp->device->base, time, LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,