From f60e0f390334c5cb03bc89b249ff20dda0574b30 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 2 Jul 2017 15:36:59 +0200 Subject: evdev-mt-touchpad: Enable timestamp smoothing support for bluetooth touchpads Bluetooth wreaks havoc with the timestamp of the input events coming from the touchpad, enable timestamp smoothing support to counter this. Signed-off-by: Hans de Goede --- src/evdev-mt-touchpad.c | 4 +++- src/filter.c | 6 +++++- src/filter.h | 4 +++- tools/ptraccel-debug.c | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 2d39e18..6af594d 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -2056,8 +2056,10 @@ tp_init_accel(struct tp_dispatch *tp) if (tp->device->model_flags & EVDEV_MODEL_LENOVO_X230 || tp->device->model_flags & EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81) filter = create_pointer_accelerator_filter_lenovo_x230(tp->device->dpi); + else if (libevdev_get_id_bustype(device->evdev) == BUS_BLUETOOTH) + filter = create_pointer_accelerator_filter_touchpad(device->dpi, ms2us(50), ms2us(10)); else - filter = create_pointer_accelerator_filter_touchpad(tp->device->dpi); + filter = create_pointer_accelerator_filter_touchpad(device->dpi, 0, 0); if (!filter) return false; diff --git a/src/filter.c b/src/filter.c index 49d324e..faf8d31 100644 --- a/src/filter.c +++ b/src/filter.c @@ -1028,7 +1028,9 @@ struct motion_filter_interface accelerator_interface_touchpad = { }; struct motion_filter * -create_pointer_accelerator_filter_touchpad(int dpi) +create_pointer_accelerator_filter_touchpad(int dpi, + uint64_t event_delta_smooth_threshold, + uint64_t event_delta_smooth_value) { struct pointer_accelerator *filter; @@ -1038,6 +1040,8 @@ create_pointer_accelerator_filter_touchpad(int dpi) filter->base.interface = &accelerator_interface_touchpad; filter->profile = touchpad_accel_profile_linear; + filter->event_delta_smooth_threshold = event_delta_smooth_threshold; + filter->event_delta_smooth_value = event_delta_smooth_value; return &filter->base; } diff --git a/src/filter.h b/src/filter.h index e24c20d..131f801 100644 --- a/src/filter.h +++ b/src/filter.h @@ -114,7 +114,9 @@ struct motion_filter * create_pointer_accelerator_filter_linear_low_dpi(int dpi); struct motion_filter * -create_pointer_accelerator_filter_touchpad(int dpi); +create_pointer_accelerator_filter_touchpad(int dpi, + uint64_t event_delta_smooth_threshold, + uint64_t event_delta_smooth_value); struct motion_filter * create_pointer_accelerator_filter_lenovo_x230(int dpi); diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c index acb82c6..1fc31de 100644 --- a/tools/ptraccel-debug.c +++ b/tools/ptraccel-debug.c @@ -314,7 +314,7 @@ main(int argc, char **argv) filter = create_pointer_accelerator_filter_linear_low_dpi(dpi); profile = pointer_accel_profile_linear_low_dpi; } else if (streq(filter_type, "touchpad")) { - filter = create_pointer_accelerator_filter_touchpad(dpi); + filter = create_pointer_accelerator_filter_touchpad(dpi, 0, 0); profile = touchpad_accel_profile_linear; } else if (streq(filter_type, "x230")) { filter = create_pointer_accelerator_filter_lenovo_x230(dpi); -- cgit v1.2.3