[PATCH 3/3] touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta

Hans de Goede hdegoede at redhat.com
Fri Dec 12 04:15:49 PST 2014


Hi,

On 10-12-14 04:34, Peter Hutterer wrote:
> On Tue, Dec 09, 2014 at 12:47:11PM +0100, Hans de Goede wrote:
>> Use TOUCHPAD_MIN_SAMPLES in tp_get_delta rather then hardcoding "4".
>
> s/then/than/
>
>> Also remove the superfluous TOUCHPAD_MIN_SAMPLES check before calling
>> tp_get_delta in tp_get_pointer_delta, this is not necessary as tp_get_delta
>> already checks itself.
>
> Right, though note that you're now passing the initial 0/0 deltas into the
> filter and thus feed the velocity trackers. Not that it has any effect,
> 0 + 0 is still 0...

Not true, tp_filter_motion has:

         if (motion.dx != 0.0 || motion.dy != 0.0)
                 filter_dispatch(tp->device->pointer.filter, &motion, tp, time);

So the filter will not see the 0,0 event(s), I checked that before making this change.

Regards,

Hans

p.s.

Any reason you did not review patch 1/3 ?

>
> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
>
> Cheers,
>     Peter
>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>   src/evdev-mt-touchpad.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
>> index 7cee73d..397b8b9 100644
>> --- a/src/evdev-mt-touchpad.c
>> +++ b/src/evdev-mt-touchpad.c
>> @@ -177,7 +177,7 @@ tp_estimate_delta(int x0, int x1, int x2, int x3)
>>   void
>>   tp_get_delta(struct tp_touch *t, double *dx, double *dy)
>>   {
>> -	if (t->history.count < 4) {
>> +	if (t->history.count < TOUCHPAD_MIN_SAMPLES) {
>>   		*dx = 0;
>>   		*dy = 0;
>>   		return;
>> @@ -607,9 +607,7 @@ tp_get_pointer_delta(struct tp_dispatch *tp, double *dx, double *dy)
>>   		}
>>   	}
>>
>> -	if (!t->is_pointer ||
>> -	    !t->dirty ||
>> -	    t->history.count < TOUCHPAD_MIN_SAMPLES)
>> +	if (!t->is_pointer || !t->dirty)
>>   		return;
>>
>>   	tp_get_delta(t, dx, dy);
>> --
>> 2.1.0
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>


More information about the wayland-devel mailing list