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>
This commit is contained in:
parent
4318075140
commit
73b01a9aac
|
@ -950,7 +950,7 @@ acceleratePointerPredictable(
|
||||||
int *px = NULL, *py = NULL;
|
int *px = NULL, *py = NULL;
|
||||||
DeviceVelocityPtr velocitydata =
|
DeviceVelocityPtr velocitydata =
|
||||||
(DeviceVelocityPtr) pDev->valuator->accelScheme.accelData;
|
(DeviceVelocityPtr) pDev->valuator->accelScheme.accelData;
|
||||||
float fdx, fdy; /* no need to init */
|
float fdx, fdy, tmp; /* no need to init */
|
||||||
Bool soften = TRUE;
|
Bool soften = TRUE;
|
||||||
|
|
||||||
if (!num_valuators || !valuators || !velocitydata)
|
if (!num_valuators || !valuators || !velocitydata)
|
||||||
|
@ -985,14 +985,14 @@ acceleratePointerPredictable(
|
||||||
(mult > 1.0) && soften);
|
(mult > 1.0) && soften);
|
||||||
|
|
||||||
if (dx) {
|
if (dx) {
|
||||||
pDev->last.remainder[0] = roundf(mult * fdx + pDev->last.remainder[0]);
|
tmp = mult * fdx + pDev->last.remainder[0];
|
||||||
*px = (int)pDev->last.remainder[0];
|
*px = (int)roundf(tmp);
|
||||||
pDev->last.remainder[0] = pDev->last.remainder[0] - (float)*px;
|
pDev->last.remainder[0] = tmp - (float)*px;
|
||||||
}
|
}
|
||||||
if (dy) {
|
if (dy) {
|
||||||
pDev->last.remainder[1] = roundf(mult * fdy + pDev->last.remainder[1]);
|
tmp = mult * fdy + pDev->last.remainder[1];
|
||||||
*py = (int)pDev->last.remainder[1];
|
*py = (int)roundf(tmp);
|
||||||
pDev->last.remainder[1] = pDev->last.remainder[1] - (float)*py;
|
pDev->last.remainder[1] = tmp - (float)*py;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user