summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Kogan <dkogan@secretsauce.net>2009-08-16 22:27:28 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2009-08-18 12:01:52 +1000
commitbf95ccf496d6674a83c44d559e3eef8729c69449 (patch)
tree01ae929e5d1b1dcf7b549d5fff70f45e30823ec5
parent2d43329d778d7bfae5d9c99611ad49efa56716a6 (diff)
Restrict wheel emulation to a single axis at a time.
Wheel emulation works for both horizontal and vertical axes. Thus, if a device doesn't move in perfect straight line, scroll events build up on the respective other axis. In some clients, scroll wheel events have specific meanings other than scrolling (e.g. mplayer). In these clients, erroneous scrolling events come at a high cost. Thus, if a scroll wheel event is generated for one axis, reset the inertia of the other axis to 0, avoiding the buildup of these erroneous scrolling events. Signed-off-by: Dima Kogan <dkogan@secretsauce.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/mouse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mouse.c b/src/mouse.c
index 0e22314..8bd659e 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -2102,6 +2102,7 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
while (abs(pMse->wheelYDistance) > pMse->wheelInertia) {
pMse->wheelYDistance -= emuWheelDelta;
+ pMse->wheelXDistance = 0;
/*
* Synthesize the press and release, but not when
* the button to be synthesized is already pressed
@@ -2129,6 +2130,7 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
while (abs(pMse->wheelXDistance) > pMse->wheelInertia) {
pMse->wheelXDistance -= emuWheelDelta;
+ pMse->wheelYDistance = 0;
/*
* Synthesize the press and release, but not when
* the button to be synthesized is already pressed