diff options
Diffstat (limited to 'xorg-server/dix/ptrveloc.c')
-rw-r--r-- | xorg-server/dix/ptrveloc.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c index b9ece2159..ffc1a1d85 100644 --- a/xorg-server/dix/ptrveloc.c +++ b/xorg-server/dix/ptrveloc.c @@ -92,8 +92,6 @@ GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); /* some int which is not a profile number */
#define PROFILE_UNINITIALIZE (-100)
-/* number of properties for predictable acceleration */
-#define NPROPS_PREDICTABLE_ACCEL 4
/**
* Init struct so it should match the average case
@@ -332,26 +330,18 @@ AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel) return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
}
-static int AccelPropHandlerPrivateKeyIndex;
-DevPrivateKey AccelPropHandlerPrivateKey = &AccelPropHandlerPrivateKeyIndex;
-
BOOL
InitializePredictableAccelerationProperties(DeviceIntPtr dev)
{
DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
- long *prop_handlers;
if(!vel)
return FALSE;
- prop_handlers = xalloc(NPROPS_PREDICTABLE_ACCEL * sizeof(long));
-
- prop_handlers[0] = AccelInitProfileProperty(dev, vel);
- prop_handlers[1] = AccelInitDecelProperty(dev, vel);
- prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
- prop_handlers[3] = AccelInitScaleProperty(dev, vel);
- dixSetPrivate(&dev->devPrivates, AccelPropHandlerPrivateKey,
- prop_handlers);
+ vel->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
+ vel->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
+ vel->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
+ vel->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
return TRUE;
}
@@ -359,8 +349,8 @@ InitializePredictableAccelerationProperties(DeviceIntPtr dev) BOOL
DeletePredictableAccelerationProperties(DeviceIntPtr dev)
{
+ DeviceVelocityPtr vel;
Atom prop;
- long *prop_handlers;
int i;
prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
@@ -372,13 +362,10 @@ DeletePredictableAccelerationProperties(DeviceIntPtr dev) prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
XIDeleteDeviceProperty(dev, prop, FALSE);
- prop_handlers = dixLookupPrivate(&dev->devPrivates,
- AccelPropHandlerPrivateKey);
- dixSetPrivate(&dev->devPrivates, AccelPropHandlerPrivateKey, NULL);
-
- for (i = 0; prop_handlers && i < NPROPS_PREDICTABLE_ACCEL; i++)
- XIUnregisterPropertyHandler(dev, prop_handlers[i]);
- xfree(prop_handlers);
+ vel = GetDevicePredictableAccelData(dev);
+ for (i = 0; vel && i < NPROPS_PREDICTABLE_ACCEL; i++)
+ if (vel->prop_handlers[i])
+ XIUnregisterPropertyHandler(dev, vel->prop_handlers[i]);
return TRUE;
}
|