diff options
author | Max Schwarz <Max@x-quadraht.de> | 2011-09-25 20:44:26 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-09-30 09:25:03 +1000 |
commit | f32c827d513c44f07e1d0fbcc0c96cef18c9a4d9 (patch) | |
tree | b330799aba0ddc6a69736905a686ff807a7023bb /dix/eventconvert.c | |
parent | 4c6bc0e76599dbe5ede2e1f48c9936a0e996b638 (diff) |
Input: Fix frac calculation on [Raw]DeviceEvent conversion
(1UL << 32) evaluates to 0 (at least here), so do the
fraction calculation in two steps as in libXi. Fractions on xXIRawEvent
were not multiplied at all, which also gave 0 as result.
Signed-off-by: Max Schwarz <Max@x-quadraht.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r-- | dix/eventconvert.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 9cc177efc..f9aafa5d1 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -635,7 +635,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi) SetBit(ptr, i); axisval->integral = trunc(ev->valuators.data[i]); axisval->frac = (ev->valuators.data[i] - axisval->integral) * - (1UL << 32); + (1 << 16) * (1 << 16); axisval++; } } @@ -679,10 +679,12 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi) { SetBit(ptr, i); axisval->integral = trunc(ev->valuators.data[i]); - axisval->frac = ev->valuators.data[i] - axisval->integral; + axisval->frac = (ev->valuators.data[i] - axisval->integral) * + (1 << 16) * (1 << 16); axisval_raw->integral = trunc(ev->valuators.data_raw[i]); - axisval_raw->frac = ev->valuators.data_raw[i] - - axisval_raw->integral; + axisval_raw->frac = + (ev->valuators.data_raw[i] - axisval_raw->integral) * + (1 << 16) * (1 << 16); axisval++; axisval_raw++; } |