summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-02-21 17:12:17 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-03-07 17:20:20 +0000
commit028360726a6a73f5683c0c840e6f6b33ec03b465 (patch)
tree479986860867b2faa17f130bc576d8a46fcf2a48
parentefc236bf40a1f036bcc2fbc348361d63e4547921 (diff)
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.
-rw-r--r--hw/xwin/win.h6
-rw-r--r--hw/xwin/winmessages.h2
-rw-r--r--hw/xwin/winmultiwindowwndproc.c12
-rw-r--r--hw/xwin/winwin32rootlesswndproc.c9
-rw-r--r--hw/xwin/winwndproc.c16
-rw-r--r--hw/xwin/wmutil/mouse.c11
-rw-r--r--hw/xwin/wmutil/mouse.h2
7 files changed, 48 insertions, 10 deletions
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 11748cef2..5e0ca8901 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -42,6 +42,11 @@
#define YES 1
#endif
+/* We can handle WM_MOUSEHWHEEL even though _WIN32_WINNT < 0x0600 */
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020E
+#endif
+
/* Turn debug messages on or off */
#ifndef CYGDEBUG
#define CYGDEBUG NO
@@ -449,6 +454,7 @@ typedef struct _winPrivScreenRec {
Bool fBadDepth;
int iDeltaZ;
+ int iDeltaV;
int iConnectedClients;
diff --git a/hw/xwin/winmessages.h b/hw/xwin/winmessages.h
index 3d3fab274..8282f8b06 100644
--- a/hw/xwin/winmessages.h
+++ b/hw/xwin/winmessages.h
@@ -529,7 +529,7 @@ static const char *MESSAGE_NAMES[1024] = {
"WM_XBUTTONDOWN",
"WM_XBUTTONUP",
"WM_XBUTTONDBLCLK",
- "526",
+ "WM_MOUSEHWHEEL",
"527",
"WM_PARENTNOTIFY",
"WM_ENTERMENULOOP",
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index c5ff7a785..c1efeb73d 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -685,6 +685,18 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
else
break;
+ case WM_MOUSEHWHEEL:
+ if (SendMessage
+ (hwnd, WM_NCHITTEST, 0,
+ MAKELONG(GET_X_LPARAM(lParam),
+ GET_Y_LPARAM(lParam))) == HTCLIENT) {
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
+ }
+ else
+ break;
+
case WM_SETFOCUS:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c
index 9c282ecb4..be2958338 100644
--- a/hw/xwin/winwin32rootlesswndproc.c
+++ b/hw/xwin/winwin32rootlesswndproc.c
@@ -667,6 +667,15 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
SendMessage(hwndScreen, message, wParam, lParam);
return 0;
+ case WM_MOUSEHWHEEL:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug("winMWExtWMWindowProc - WM_MOUSEHWHEEL\n");
+#endif
+
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
+
case WM_MOUSEACTIVATE:
#if CYGMULTIWINDOW_DEBUG
winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n");
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index b4c847877..906055fd4 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -979,7 +979,20 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#if CYGDEBUG
winDebug("winWindowProc - WM_MOUSEWHEEL\n");
#endif
- winMouseWheel(&(s_pScreenPriv->iDeltaZ), GET_WHEEL_DELTA_WPARAM(wParam));
+ /* Button4 = WheelUp */
+ /* Button5 = WheelDown */
+ winMouseWheel(&(s_pScreenPriv->iDeltaZ), GET_WHEEL_DELTA_WPARAM(wParam), Button4, Button5);
+ break;
+
+ case WM_MOUSEHWHEEL:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+#if CYGDEBUG
+ winDebug("winWindowProc - WM_MOUSEHWHEEL\n");
+#endif
+ /* Button7 = TiltRight */
+ /* Button6 = TiltLeft */
+ winMouseWheel(&(s_pScreenPriv->iDeltaV), GET_WHEEL_DELTA_WPARAM(wParam), 7, 6);
break;
case WM_SETFOCUS:
@@ -1150,6 +1163,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* Clear any lingering wheel delta */
s_pScreenPriv->iDeltaZ = 0;
+ s_pScreenPriv->iDeltaV = 0;
/* Reshow the Windows mouse cursor if we are being deactivated */
if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE && !g_fCursor) {
diff --git a/hw/xwin/wmutil/mouse.c b/hw/xwin/wmutil/mouse.c
index 4c96d9cdd..b17a89013 100644
--- a/hw/xwin/wmutil/mouse.c
+++ b/hw/xwin/wmutil/mouse.c
@@ -42,12 +42,9 @@
/* Handle the mouse wheel */
void
-winMouseWheel(int *iTotalDeltaZ, int iDeltaZ)
+winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown)
{
- int button; /* Button4 or Button5 */
-
- /* Button4 = WheelUp */
- /* Button5 = WheelDown */
+ int button;
/* Do we have any previous delta stored? */
if (((*iTotalDeltaZ) > 0 && iDeltaZ > 0)
@@ -88,10 +85,10 @@ winMouseWheel(int *iTotalDeltaZ, int iDeltaZ)
/* Set the button to indicate up or down wheel delta */
if (iDeltaZ > 0) {
- button = Button4;
+ button = iButtonUp;
}
else {
- button = Button5;
+ button = iButtonDown;
}
/*
diff --git a/hw/xwin/wmutil/mouse.h b/hw/xwin/wmutil/mouse.h
index ddde7be8b..8bd6fe9eb 100644
--- a/hw/xwin/wmutil/mouse.h
+++ b/hw/xwin/wmutil/mouse.h
@@ -28,7 +28,7 @@
#include <stdbool.h>
-void winMouseWheel(int *iTotalDeltaz, int iDeltaZ);
+void winMouseWheel(int *iTotalDeltaz, int iDeltaZ, int iButtonUp, int iButtonDown);
/* Callback for sending mouse button events */
void winMouseButtonsSendEvent(bool bPress, int iButton);