From 36af7454e7bbd212d9bbe1fe67a8a9ad6a412898 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 16 Aug 2009 22:27:28 -0700 Subject: [PATCH] [PATCH] 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 --- src/mouse.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index 1899edc..897c985 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 -- 1.6.2.4