diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-06-29 21:26:42 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-06-29 21:26:42 +0100 |
commit | 1a1f5399e69b21e4398b7714a5747060a84c8ea6 (patch) | |
tree | baf353fce1ff8736873ac44d64a54c8780e37909 /src | |
parent | 6be1857cb58381f702e9726ba3d2d78ed5341cc3 (diff) |
Mouse wheel support update to align with XWin
Update for winMouseWheel() interface change in libwmutil
Add handling for WM_MOUSEHWHEEL messages
Change mouse buttons 4 and 5 from X buttons 6 and 7 to X buttons 8 and 9, which,
with mouse tilt wheel as X buttons 6 and 7, matches the default configuration on
Linux.
Diffstat (limited to 'src')
-rw-r--r-- | src/winmessages.h | 2 | ||||
-rw-r--r-- | src/wndproc.c | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/winmessages.h b/src/winmessages.h index 8b04277..ca38eec 100644 --- a/src/winmessages.h +++ b/src/winmessages.h @@ -551,7 +551,7 @@ static const char *MESSAGE_NAMES[1024] = { "WM_XBUTTONDOWN", "WM_XBUTTONUP", "WM_XBUTTONDBLCLK", - "526", + "WM_MOUSEHWHEEL", "527", "WM_PARENTNOTIFY", "WM_ENTERMENULOOP", diff --git a/src/wndproc.c b/src/wndproc.c index a8125ae..79cc968 100644 --- a/src/wndproc.c +++ b/src/wndproc.c @@ -47,6 +47,11 @@ #define WIN_XCWM_PROP "cyg_xcwm_prop" #define WIN_HDWP_PROP "cyg_hdwp_prop" +/* We can handle WM_MOUSEHWHEEL even though _WIN32_WINNT < 0x0600 */ +#ifndef WM_MOUSEHWHEEL +#define WM_MOUSEHWHEEL 0x020E +#endif + int blur = 0; PFNDWMENABLEBLURBEHINDWINDOW pDwmEnableBlurBehindWindow = NULL; @@ -845,7 +850,7 @@ winStopMousePolling(void) } } -static bool g_fButton[7] = { FALSE, FALSE, FALSE }; +static bool g_fButton[9] = { FALSE, FALSE, FALSE }; static int winMouseButtonsHandle(bool press, int iButton, HWND hWnd) @@ -915,6 +920,7 @@ winTopLevelWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* XXX: a global is wrong if WM_MOUSEMOVE of the new window is delivered before WM_MOUSELEAVE of the old? Use HWND instead? */ static bool s_fTracking = FALSE; static int iTotalDeltaZ = 0; + static int iTotalDeltaV = 0; // winDebugWin32Message("winTopLevelWindowProc", hWnd, message, wParam, lParam); @@ -934,6 +940,7 @@ winTopLevelWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: /* Clear any lingering wheel delta */ iTotalDeltaZ = 0; + iTotalDeltaV = 0; /* If we are being activated, acquire the input focus */ if (LOWORD(wParam) != WA_INACTIVE) @@ -1275,13 +1282,17 @@ winTopLevelWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: - return winMouseButtonsHandle(TRUE, HIWORD(wParam) + 5, hWnd); + return winMouseButtonsHandle(TRUE, HIWORD(wParam) + 7, hWnd); case WM_XBUTTONUP: - return winMouseButtonsHandle(FALSE, HIWORD(wParam) + 5, hWnd); + return winMouseButtonsHandle(FALSE, HIWORD(wParam) + 7, hWnd); case WM_MOUSEWHEEL: - winMouseWheel(&iTotalDeltaZ, GET_WHEEL_DELTA_WPARAM(wParam)); + winMouseWheel(&iTotalDeltaZ, GET_WHEEL_DELTA_WPARAM(wParam), 4, 5); + break; + + case WM_MOUSEHWHEEL: + winMouseWheel(&iTotalDeltaV, GET_WHEEL_DELTA_WPARAM(wParam), 7, 6); break; case WM_SETCURSOR: |