diff options
author | Roland Mainz <roland.mainz@nrubsig.org> | 2004-12-13 02:13:32 +0000 |
---|---|---|
committer | Roland Mainz <roland.mainz@nrubsig.org> | 2004-12-13 02:13:32 +0000 |
commit | 159e443a2209eb3ea305e84b847b76ef1637d005 (patch) | |
tree | 08cd4fa2e6d4713faaf9b65f3f8ba8427ccf3f22 /hw/xfree86/common/xf86Xinput.c | |
parent | f1768677f73150c686cf5678f5f5d63c0cfa8e56 (diff) |
//bugs.freedesktop.org/show_bug.cgi?id=1688) attachment #1530
(https://bugs.freedesktop.org/attachment.cgi?id=1530): Fix the current
implementation to make it possible to slow down the mouse pointer or
use arbitrary fractions (without running into rounding error issues).
The change is using the same method of preserving rounding errors that
the exponential method is already using. Patch by Jan Brunner
<Jan_B@gmx.ch>.
Diffstat (limited to 'hw/xfree86/common/xf86Xinput.c')
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index eb871a40d..0d89f895c 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -932,10 +932,15 @@ xf86PostMotionEvent(DeviceIntPtr device, /* modeled from xf86Events.c */ if (device->ptrfeed->ctrl.threshold) { if ((abs(dx) + abs(dy)) >= device->ptrfeed->ctrl.threshold) { - valuator[0] = (dx * device->ptrfeed->ctrl.num) / - device->ptrfeed->ctrl.den; - valuator[1] = (dy * device->ptrfeed->ctrl.num) / - device->ptrfeed->ctrl.den; + local->dxremaind = ((float)dx * (float)(device->ptrfeed->ctrl.num)) / + (float)(device->ptrfeed->ctrl.den) + local->dxremaind; + valuator[0] = (int)local->dxremaind; + local->dxremaind = local->dxremaind - (float)valuator[0]; + + local->dyremaind = ((float)dy * (float)(device->ptrfeed->ctrl.num)) / + (float)(device->ptrfeed->ctrl.den) + local->dyremaind; + valuator[1] = (int)local->dyremaind; + local->dyremaind = local->dyremaind - (float)valuator[1]; } } else if (dx || dy) { |