summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Thum <simon.thum@gmx.de>2009-04-08 14:35:01 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 22:17:48 +1000
commit73b01a9aac5fde46ccd90c08a070e9d2496092b9 (patch)
treecb93f58adb62b77a1f41cb2843596881970ebb84
parent4318075140cc287871d3c3b9f777289ea4ffa23a (diff)
dix: fix pointer accelerations remainder handling
This didn't really work as intended, but did amazingly well thanks to roundf() hiding the defect. Cheers! Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/ptrveloc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 2d6763ee1..92dc5890c 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -950,7 +950,7 @@ acceleratePointerPredictable(
int *px = NULL, *py = NULL;
DeviceVelocityPtr velocitydata =
(DeviceVelocityPtr) pDev->valuator->accelScheme.accelData;
- float fdx, fdy; /* no need to init */
+ float fdx, fdy, tmp; /* no need to init */
Bool soften = TRUE;
if (!num_valuators || !valuators || !velocitydata)
@@ -985,14 +985,14 @@ acceleratePointerPredictable(
(mult > 1.0) && soften);
if (dx) {
- pDev->last.remainder[0] = roundf(mult * fdx + pDev->last.remainder[0]);
- *px = (int)pDev->last.remainder[0];
- pDev->last.remainder[0] = pDev->last.remainder[0] - (float)*px;
+ tmp = mult * fdx + pDev->last.remainder[0];
+ *px = (int)roundf(tmp);
+ pDev->last.remainder[0] = tmp - (float)*px;
}
if (dy) {
- pDev->last.remainder[1] = roundf(mult * fdy + pDev->last.remainder[1]);
- *py = (int)pDev->last.remainder[1];
- pDev->last.remainder[1] = pDev->last.remainder[1] - (float)*py;
+ tmp = mult * fdy + pDev->last.remainder[1];
+ *py = (int)roundf(tmp);
+ pDev->last.remainder[1] = tmp - (float)*py;
}
}
}