diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-08-26 14:56:07 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-10-22 13:59:46 +1000 |
commit | f6fcad8b107e834e26fb3da2c89e05294ff0a74c (patch) | |
tree | 642187758dfb9d3c18364c67420b4b7c4dd615e6 /src/emuWheel.c | |
parent | d171b3d9194581cb6ed59dbe45d6cbf009dc0eaa (diff) |
Fix wheel emulation for absolute device (#68415)
wheel emulation, for some reasons beyond time, got the value from
pEvdev->vals, then set the value back into pEvdev->vals. Alas, that value is
always 0, hence oldValue is zero and the delta is nil.
If we're not in relative (touchpad) mode, store the current value in
old_vals, so they're retrievable for the next event.
X.Org Bug 68415 <http://bugs.freedesktop.org/show_bug.cgi?id=68415>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/emuWheel.c')
-rw-r--r-- | src/emuWheel.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/emuWheel.c b/src/emuWheel.c index c0e92b1..04487cf 100644 --- a/src/emuWheel.c +++ b/src/emuWheel.c @@ -97,7 +97,6 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv) EvdevPtr pEvdev = (EvdevPtr)pInfo->private; WheelAxisPtr pAxis = NULL, pOtherAxis = NULL; int value = pEv->value; - int oldValue; /* Has wheel emulation been configured to be enabled? */ if (!pEvdev->emulateWheel.enabled) @@ -117,9 +116,13 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv) if(pEv->type == EV_ABS) { int axis = pEvdev->abs_axis_map[pEv->code]; - oldValue = valuator_mask_get(pEvdev->vals, axis); - valuator_mask_set(pEvdev->vals, axis, value); - value -= oldValue; /* make value into a differential measurement */ + int oldValue; + + if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) { + valuator_mask_set(pEvdev->vals, axis, value); + value -= oldValue; /* make value into a differential measurement */ + } else + value = 0; /* avoid a jump on the first touch */ } switch(pEv->code) { |