summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Mikhaylenko <exalm7659@gmail.com>2021-03-01 21:09:37 +0500
committerPeter Hutterer <peter.hutterer@who-t.net>2021-03-16 21:29:56 +0000
commit60d5172e15728cc25db889a7a6bcf37a06a15a3a (patch)
tree5166fc6498dbdc757a038dcb16f7531f5102246f
parent1d9cdf76a566a5e95f23aba5d85840163b0f6e5f (diff)
downloadlibinput-60d5172e15728cc25db889a7a6bcf37a06a15a3a.tar.gz
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 <alexm@gnome.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev-mt-touchpad-gestures.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 22392f79..c50fa963 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,