[PATCH libinput 2/2] evdev-mt-touchpad: Enable timestamp smoothing support for bluetooth touchpads

Hans de Goede hdegoede at redhat.com
Sun Jul 2 14:35:36 UTC 2017


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 <hdegoede at redhat.com>
---
 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 2d39e18d..6af594dd 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 49d324eb..faf8d311 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 e24c20d4..131f8018 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 acb82c69..1fc31de9 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);
-- 
2.13.0



More information about the wayland-devel mailing list