aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/ptrveloc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-04 15:38:04 +0000
committermarha <marha@users.sourceforge.net>2011-03-04 15:38:04 +0000
commit3592ad31cfc72ffff3c9024eecea7d3b987c7954 (patch)
tree0e3b50cb6bcd0839b591d318a41d04b7cbd8e6e2 /xorg-server/dix/ptrveloc.c
parent79409465b0b8d5d38e6b94deb1943316f40c66eb (diff)
parent0a5888393c68f6f7db86206d1f277232db18240b (diff)
downloadvcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.tar.gz
vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.tar.bz2
vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/dix/ptrveloc.c')
-rw-r--r--xorg-server/dix/ptrveloc.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c
index 74a3d3a90..1170e767d 100644
--- a/xorg-server/dix/ptrveloc.c
+++ b/xorg-server/dix/ptrveloc.c
@@ -76,6 +76,10 @@ SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, float velocity,
float threshold, float acc);
static PointerAccelerationProfileFunc
GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
+static BOOL
+InitializePredictableAccelerationProperties(DeviceIntPtr dev);
+static BOOL
+DeletePredictableAccelerationProperties(DeviceIntPtr dev);
/*#define PTRACCEL_DEBUGGING*/
@@ -94,7 +98,7 @@ GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
/**
- * Init struct so it should match the average case
+ * Init DeviceVelocity struct so it should match the average case
*/
void
InitVelocityData(DeviceVelocityPtr vel)
@@ -116,7 +120,7 @@ InitVelocityData(DeviceVelocityPtr vel)
/**
- * Clean up
+ * Clean up DeviceVelocityRec
*/
void
FreeVelocityData(DeviceVelocityPtr vel){
@@ -125,8 +129,28 @@ FreeVelocityData(DeviceVelocityPtr vel){
}
-/*
- * dix uninit helper, called through scheme
+/**
+ * Init predictable scheme
+ */
+Bool
+InitPredictableAccelerationScheme(DeviceIntPtr dev,
+ ValuatorAccelerationPtr protoScheme) {
+ DeviceVelocityPtr vel;
+ ValuatorAccelerationRec scheme;
+ scheme = *protoScheme;
+ vel = calloc(1, sizeof(DeviceVelocityRec));
+ if (!vel)
+ return FALSE;
+ InitVelocityData(vel);
+ scheme.accelData = vel;
+ dev->valuator->accelScheme = scheme;
+ InitializePredictableAccelerationProperties(dev);
+ return TRUE;
+}
+
+
+/**
+ * Uninit scheme
*/
void
AccelerationDefaultCleanup(DeviceIntPtr dev)
@@ -1033,12 +1057,10 @@ acceleratePointerPredictable(
int *valuators,
int evtime)
{
- float mult = 0.0;
+ float fdx, fdy, tmp, mult; /* no need to init */
int dx = 0, dy = 0;
int *px = NULL, *py = NULL;
- DeviceVelocityPtr velocitydata =
- (DeviceVelocityPtr) dev->valuator->accelScheme.accelData;
- float fdx, fdy, tmp; /* no need to init */
+ DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
Bool soften = TRUE;
if (!num_valuators || !valuators || !velocitydata)
@@ -1071,11 +1093,11 @@ acceleratePointerPredictable(
(float)dev->ptrfeed->ctrl.num /
(float)dev->ptrfeed->ctrl.den);
- if(mult != 1.0 || velocitydata->const_acceleration != 1.0) {
+ if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
ApplySofteningAndConstantDeceleration( velocitydata,
dx, dy,
&fdx, &fdy,
- (mult > 1.0) && soften);
+ (mult > 1.0f) && soften);
if (dx) {
tmp = mult * fdx + dev->last.remainder[0];