From 4e32e6fb38d19c9993de86188e4f7e7916a028e2 Mon Sep 17 00:00:00 2001 From: Simon Thum Date: Wed, 23 Jul 2008 11:10:22 +0200 Subject: [PATCH] dix: rename classic accel _scheme_ to lightweight to avoid confusion with classic accel _profile_ Signed-off-by: Peter Hutterer --- dix/devices.c | 13 ++++++++++--- dix/ptrveloc.c | 8 ++++++-- include/input.h | 2 +- include/ptrveloc.h | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 383c1c799..d8e37d790 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1269,10 +1269,14 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, ValuatorAccelerationRec pointerAccelerationScheme[] = { {PtrAccelNoOp, NULL, NULL, NULL}, {PtrAccelPredictable, acceleratePointerPredictable, NULL, AccelerationDefaultCleanup}, - {PtrAccelClassic, acceleratePointerClassic, NULL, NULL}, + {PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL}, {-1, NULL, NULL, NULL} /* terminator */ }; +/** + * install an acceleration scheme. retrns TRUE on success, and should not + * change anything if unsuccessful. + */ _X_EXPORT Bool InitPointerAccelerationScheme(DeviceIntPtr dev, int scheme) @@ -1281,7 +1285,9 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, void* data = NULL; ValuatorClassPtr val; - if(dev->isMaster) /* bail out if called for master devs */ + val = dev->valuator; + + if(!val || dev->isMaster) /* bail out if called for master devs */ return FALSE; for(x = 0; pointerAccelerationScheme[x].number >= 0; x++) { @@ -1301,6 +1307,8 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, { DeviceVelocityPtr s; s = (DeviceVelocityPtr)xalloc(sizeof(DeviceVelocityRec)); + if(!s) + return FALSE; InitVelocityData(s); data = s; break; @@ -1309,7 +1317,6 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, break; } - val = dev->valuator; val->accelScheme = pointerAccelerationScheme[i]; val->accelScheme.accelData = data; diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index ce0af2235..92e737da8 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -722,8 +722,12 @@ acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator, * in-place. Retained mostly for embedded scenarios. */ void -acceleratePointerClassic(DeviceIntPtr pDev, int first_valuator, - int num_valuators, int *valuators, int ignored) +acceleratePointerLightweight( + DeviceIntPtr pDev, + int first_valuator, + int num_valuators, + int *valuators, + int ignored) { float mult = 0.0; int dx = 0, dy = 0; diff --git a/include/input.h b/include/input.h index ba4492839..2e4027249 100644 --- a/include/input.h +++ b/include/input.h @@ -66,7 +66,7 @@ SOFTWARE. /*int constants for pointer acceleration schemes*/ #define PtrAccelNoOp 0 #define PtrAccelPredictable 1 -#define PtrAccelClassic 2 +#define PtrAccelLightweight 2 #define PtrAccelDefault PtrAccelPredictable #define MAX_VALUATORS 36 /* XXX from comment in dix/getevents.c */ diff --git a/include/ptrveloc.h b/include/ptrveloc.h index e4969133c..30a22bc33 100644 --- a/include/ptrveloc.h +++ b/include/ptrveloc.h @@ -103,7 +103,7 @@ acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator, int num_valuators, int *valuators, int evtime); extern void -acceleratePointerClassic(DeviceIntPtr pDev, int first_valuator, +acceleratePointerLightweight(DeviceIntPtr pDev, int first_valuator, int num_valuators, int *valuators, int ignore); #endif /* POINTERVELOCITY_H */