[PATCH] touchpad: Only use slot 0 deltas for 2fg scrolling on semi-mt touchpads

Hans de Goede hdegoede at redhat.com
Mon Apr 27 01:43:22 PDT 2015


Hi,

On 27-04-15 03:21, Peter Hutterer wrote:
> On Fri, Apr 24, 2015 at 04:49:36PM +0200, Hans de Goede wrote:
>> Some semi-mt model touchpads have a better accuracy for slot 0 then for
>> slot 1 (they only have 2), so on semi-mt models only use the movement of
>> the touch in slot 0 for 2fg scrolling, rather then the average movement of
>> the 2 touches.
>>
>> This fixes 2fg scrolling being choppy / jumpy in some cases.
>>
>> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89683
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>   src/evdev-mt-touchpad-gestures.c | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
>> index d332186..57c07fe 100644
>> --- a/src/evdev-mt-touchpad-gestures.c
>> +++ b/src/evdev-mt-touchpad-gestures.c
>> @@ -113,7 +113,17 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
>>   	if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
>>   		return;
>>
>> -	delta = tp_get_average_touches_delta(tp);
>> +	/* On some semi-mt models slot 0 is more accurate, so for semi-mt
>> +	 * we only use slot 0. */
>> +	if (tp->semi_mt) {
>> +		if (!tp->touches[0].dirty)
>> +			return;
>> +
>> +		delta = tp_get_delta(&tp->touches[0]);
>> +	} else {
>> +		delta = tp_get_average_touches_delta(tp);
>> +	}
>> +
>>   	delta = tp_filter_motion(tp, &delta, time);
>>
>>   	if (normalized_is_zero(delta))
>> --
>> 2.3.5
>
> pushed, thanks. I had to fix one of the tests since it kept failing here
> (see commit 07b20dc) and in the process added a test for this behaviour as
> follow-up.

Oops, it was like 5 minutes before my wife was expecting me for dinner and
I had been working the entire day on the kernel side of things, so I must
admit I did not run the test suite.

Thanks for fixing this.

Regards,

Hans


More information about the wayland-devel mailing list