From 805f28e96ceb20bc53792ae3cf17f9c26564ae0e Mon Sep 17 00:00:00 2001 From: Simon Thum Date: Wed, 23 Jul 2008 12:10:52 +0200 Subject: [PATCH] some trivial changes regarding C compat, indentation, etc. Signed-off-by: Peter Hutterer --- dix/ptrveloc.c | 23 ++++++++++++++++------- hw/xfree86/common/xf86Xinput.c | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index d6cd8c5af..21a2eca48 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -458,7 +458,10 @@ ApplySofteningAndConstantDeceleration( * Polynomial function similar previous one, but with f(1) = 1 */ static float -PolynomialAccelerationProfile(DeviceVelocityPtr pVel, float ignored, float acc) +PolynomialAccelerationProfile( + DeviceVelocityPtr pVel, + float ignored, + float acc) { return pow(pVel->velocity, (acc - 1.0) * 0.5); } @@ -474,7 +477,6 @@ ClassicProfile( float threshold, float acc) { - if (threshold) { return SimpleSmoothProfile (pVel, threshold, @@ -516,7 +518,8 @@ PowerProfile( * just a smooth function in [0..1] -> [0..1] * - point symmetry at 0.5 * - f'(0) = f'(1) = 0 - * - starts faster than sinoids, C1 (Cinf if you dare to ignore endpoints) + * - starts faster than a sinoid + * - smoothness C1 (Cinf if you dare to ignore endpoints) */ static inline float CalcPenumbralGradient(float x){ @@ -561,13 +564,15 @@ SmoothLinearProfile( float threshold, float acc) { + float res, nv; + if(acc > 1.0f) acc -= 1.0f; /*this is so acc = 1 is no acceleration */ else return 1.0f; - float nv = (pVel->velocity - threshold) * acc * 0.5f; - float res; + nv = (pVel->velocity - threshold) * acc * 0.5f; + if(nv < 0){ res = 0; }else if(nv < 2){ @@ -696,8 +701,12 @@ GetDevicePredictableAccelData( * enable fine-grained predictable acceleration profiles. */ void -acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator, - int num_valuators, int *valuators, int evtime) +acceleratePointerPredictable( + DeviceIntPtr pDev, + int first_valuator, + int num_valuators, + int *valuators, + int evtime) { float mult = 0.0; int dx = 0, dy = 0; diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index fbd10e97d..ea4dbbad2 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -138,7 +138,7 @@ ProcessVelocityConfiguration(char* devname, pointer list, DeviceVelocityPtr s){ s->min_acceleration = 1.0 / tempf; /* set minimum acceleration */ } - tempf = xf86SetRealOption(list, "VelocityCoupling", 0.2); + tempf = xf86SetRealOption(list, "VelocityCoupling", 0.25); xf86Msg(X_CONFIG, "%s: (accel) velocity coupling is %.1f%%\n", devname, tempf*100.0); s->coupling = tempf;