[PATCH evdev 2/2] Don't reset the other axis on wheel emulation scroll buildup
Peter Hutterer
peter.hutterer at who-t.net
Tue Jan 19 16:48:58 PST 2016
The idea was that of a direction lock: as we move vertically we should not
build up any horizontal scroll motion even if we move slightly diagonally.
The effect was though that the axis would be reset completely as soon as an
event from the other axis occured. With the default threshold of 10, if one in
ten events was a REL_X, we'd never get a wheel event.
Drop this code, it's not needed. By default wheel emulation doesn't do
horizontal scrolling, if a config snippet sets XAxisMapping the user wants
horizontal scrolling. And since we just add the value anyway, as long as the
user does a roughly vertical motion we won't get over the threshold anyway.
https://bugs.freedesktop.org/show_bug.cgi?id=93617
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/emuWheel.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/emuWheel.c b/src/emuWheel.c
index f1d1990..c82c240 100644
--- a/src/emuWheel.c
+++ b/src/emuWheel.c
@@ -95,7 +95,7 @@ BOOL
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
- WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
+ WheelAxisPtr pAxis = NULL;
int value = pEv->value;
/* Has wheel emulation been configured to be enabled? */
@@ -130,13 +130,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
/* ABS_X has the same value as REL_X, so this case catches both */
case REL_X:
pAxis = &(pEvdev->emulateWheel.X);
- pOtherAxis = &(pEvdev->emulateWheel.Y);
break;
/* ABS_Y has the same value as REL_Y, so this case catches both */
case REL_Y:
pAxis = &(pEvdev->emulateWheel.Y);
- pOtherAxis = &(pEvdev->emulateWheel.X);
break;
default:
@@ -144,15 +142,10 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
}
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
- wheel. Reset the inertia of the other axis when a scroll event
- was sent to avoid the buildup of erroneous scroll events if the
- user doesn't move in a perfectly straight line.
+ wheel.
*/
if (pAxis)
- {
- if (EvdevWheelEmuInertia(pInfo, pAxis, value))
- pOtherAxis->traveled_distance = 0;
- }
+ EvdevWheelEmuInertia(pInfo, pAxis, value);
/* Eat motion events while emulateWheel button pressed. */
return TRUE;
--
2.5.0
More information about the xorg-devel
mailing list