[PATCH libinput 2/4] touchpad: only post motion events if we have motion

Peter Hutterer peter.hutterer at who-t.net
Fri Apr 1 01:10:39 UTC 2016


Because our delta calculation factors in previous events on touchpads (to
reduce jitter) we may get a nonzero delta if we have an event that doesn't
actually change x or y.

Drop the t->dirty workaround introduced in a608d9d, an event that virtually
disappears can mess up our state machines.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-gestures.c | 3 ++-
 src/evdev-mt-touchpad.c          | 5 +----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 3c8f5a7..7bbd3b8 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -500,7 +500,8 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
 
 	switch (tp->gesture.finger_count) {
 	case 1:
-		tp_gesture_post_pointer_motion(tp, time);
+		if (tp->queued & TOUCHPAD_EVENT_MOTION)
+			tp_gesture_post_pointer_motion(tp, time);
 		break;
 	case 2:
 	case 3:
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index f634ec8..e16aecb 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -904,10 +904,7 @@ tp_need_motion_history_reset(struct tp_dispatch *tp)
 	if (tp->device->model_flags & EVDEV_MODEL_LENOVO_T450_TOUCHPAD) {
 		if (tp->queued & TOUCHPAD_EVENT_MOTION) {
 			if (tp->quirks.nonmotion_event_count > 10) {
-				struct tp_touch *t;
-
-				tp_for_each_touch(tp, t)
-				t->dirty = false;
+				tp->queued &= ~TOUCHPAD_EVENT_MOTION;
 				rc = true;
 			}
 			tp->quirks.nonmotion_event_count = 0;
-- 
2.5.0



More information about the wayland-devel mailing list