diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-02-21 17:12:17 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-07-23 23:59:27 +0100 |
commit | 71b5f56302bbd8be62f63f0dd62cbcd33aab3ac5 (patch) | |
tree | fe1ac084cb57bdcbf163b60d739283a3f8a09b93 /hw/xwin/winmouse.c | |
parent | cf9c777ee094d660e0c95559373fd23ee910362e (diff) |
hw/xwin: Handle WM_MOUSEHWHEEL
Handle WM_MOUSEHWHEEL tilt wheel messages, similarly to WM_MOUSEWHEEL scroll
wheel messages, to generate X button 6 and 7 presses and releases.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'hw/xwin/winmouse.c')
-rw-r--r-- | hw/xwin/winmouse.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index da067cde0..bbe21cba6 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -145,20 +145,16 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState) /* Handle the mouse wheel */ int -winMouseWheel(ScreenPtr pScreen, int iDeltaZ) +winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown) { - winScreenPriv(pScreen); - int button; /* Button4 or Button5 */ - - /* Button4 = WheelUp */ - /* Button5 = WheelDown */ + int button; /* Do we have any previous delta stored? */ - if ((pScreenPriv->iDeltaZ > 0 && iDeltaZ > 0) - || (pScreenPriv->iDeltaZ < 0 && iDeltaZ < 0)) { + if ((*iTotalDeltaZ > 0 && iDeltaZ > 0) + || (*iTotalDeltaZ < 0 && iDeltaZ < 0)) { /* Previous delta and of same sign as current delta */ - iDeltaZ += pScreenPriv->iDeltaZ; - pScreenPriv->iDeltaZ = 0; + iDeltaZ += *iTotalDeltaZ; + *iTotalDeltaZ = 0; } else { /* @@ -167,7 +163,7 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ) * as blindly setting takes just as much time * as checking, then setting if necessary :) */ - pScreenPriv->iDeltaZ = 0; + *iTotalDeltaZ = 0; } /* @@ -175,7 +171,7 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ) * WHEEL_DELTA */ if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) { - pScreenPriv->iDeltaZ = 0; + *iTotalDeltaZ = 0; /* Figure out how many whole deltas of the wheel we have */ iDeltaZ /= WHEEL_DELTA; @@ -186,16 +182,16 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ) * we will store the wheel delta until the threshold * has been reached. */ - pScreenPriv->iDeltaZ = iDeltaZ; + *iTotalDeltaZ = iDeltaZ; return 0; } /* Set the button to indicate up or down wheel delta */ if (iDeltaZ > 0) { - button = Button4; + button = iButtonUp; } else { - button = Button5; + button = iButtonDown; } /* |