From 5870d507cee8547c0993791195fe04d96b271289 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 Apr 2011 15:32:33 +1000 Subject: [PATCH] dix: split softening and constant deceleration into two functions Signed-off-by: Peter Hutterer Reviewed-by: Daniel Stone Reviewed-by: Jamey Sharp Reviewed-by: Simon Thum --- dix/ptrveloc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index 98468bc8e..a7101fcf7 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -709,7 +709,7 @@ ApplySimpleSoftening(int prev_delta, int delta) static void -ApplySofteningAndConstantDeceleration( +ApplySoftening( DeviceVelocityPtr vel, int dx, int dy, @@ -724,7 +724,11 @@ ApplySofteningAndConstantDeceleration( *fdx = dx; *fdy = dy; } +} +static void +ApplyConstantDeceleration(DeviceVelocityPtr vel, float *fdx, float *fdy) +{ *fdx *= vel->const_acceleration; *fdy *= vel->const_acceleration; } @@ -1149,10 +1153,11 @@ acceleratePointerPredictable( (float)dev->ptrfeed->ctrl.den); if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) { - ApplySofteningAndConstantDeceleration(velocitydata, - dx, dy, - &fdx, &fdy, - (mult > 1.0f) && soften); + ApplySoftening(velocitydata, + dx, dy, + &fdx, &fdy, + (mult > 1.0f) && soften); + ApplyConstantDeceleration(velocitydata, &fdx, &fdy); /* Calculate the new delta (with accel) and drop it back * into the valuator masks */