summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-16 12:55:11 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-16 12:55:11 +0000
commitb6b8b1e71e90f4da664b6e3835d4a14b90d93105 (patch)
tree3c1dee54e4ea0b852c3d8aebe02fa9a69fa25bfc
parent17d5cbde7ba4cbafc18122d49b4ed02530c9de97 (diff)
add support for more than 3 mouse buttons and 1 scroll wheel (Chris B) (was
already commited to HEAD)
-rw-r--r--hw/xwin/ChangeLog11
-rw-r--r--hw/xwin/win.h11
-rwxr-xr-xhw/xwin/winmessages.h6
-rw-r--r--hw/xwin/winmouse.c17
-rwxr-xr-xhw/xwin/winmultiwindowwndproc.c10
-rwxr-xr-xhw/xwin/winwin32rootlesswndproc.c12
-rw-r--r--hw/xwin/winwndproc.c22
7 files changed, 79 insertions, 10 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog
index ad218a6d2..734aa29a1 100644
--- a/hw/xwin/ChangeLog
+++ b/hw/xwin/ChangeLog
@@ -4,6 +4,17 @@
Remove code which prevented the use from specifying the window
size in nodecoration mode.
+2004-08-26 Chris B <news at sempermax dot com>
+
+ * win.h, winmessages.h:
+ Add defines for WM_XBUTTON
+ * winmouse.c (winMouseProc):
+ Query number of mouse buttons from windows.
+ * winmultiwindowwndproc.c (winTopLevelWindowProc):
+ * winwin32rootlesswndproc.c (winMWExtWMWindowProc):
+ * winwndproc.c (winWindowProc):
+ Handle WM_XBUTTON messages.
+
2004-08-02 Kensuke Matsuzaki
* winclipboardthread.c winclipboardwndproc.c:
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 3660b9623..33e874f1c 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -48,6 +48,17 @@
#define CYGDEBUG NO
#endif
+/* WM_XBUTTON Messages. They should go into w32api. */
+#ifndef WM_XBUTTONDOWN
+# define WM_XBUTTONDOWN 523
+#endif
+#ifndef WM_XBUTTONUP
+# define WM_XBUTTONUP 524
+#endif
+#ifndef WM_XBUTTONDBLCLK
+# define WM_XBUTTONDBLCLK 525
+#endif
+
#define NEED_EVENTS
#define WIN_DEFAULT_BPP 0
diff --git a/hw/xwin/winmessages.h b/hw/xwin/winmessages.h
index 8fb8fe4cd..3896fb48c 100755
--- a/hw/xwin/winmessages.h
+++ b/hw/xwin/winmessages.h
@@ -523,9 +523,9 @@ static const char *MESSAGE_NAMES[1024] = {
"WM_MBUTTONUP",
"WM_MBUTTONDBLCLK",
"WM_MOUSEWHEEL",
- "523",
- "524",
- "525",
+ "WM_XBUTTONDOWN",
+ "WM_XBUTTONUP",
+ "WM_XBUTTONDBLCLK",
"526",
"527",
"WM_PARENTNOTIFY",
diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c
index 46850652b..6411d7989 100644
--- a/hw/xwin/winmouse.c
+++ b/hw/xwin/winmouse.c
@@ -64,23 +64,26 @@ winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl)
int
winMouseProc (DeviceIntPtr pDeviceInt, int iState)
{
- CARD8 map[6];
+ int lngMouseButtons, i;
+ CARD8 *map;
DevicePtr pDevice = (DevicePtr) pDeviceInt;
switch (iState)
{
case DEVICE_INIT:
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
- map[4] = 4;
- map[5] = 5;
+ lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ ErrorF ("%d mouse buttons found\n", lngMouseButtons);
+ map = malloc(sizeof(CARD8) * (lngMouseButtons + 1 + 2));
+
+ for (i=1; i <= lngMouseButtons + 2; i++)
+ map[i] = i;
InitPointerDeviceStruct (pDevice,
map,
- 5, /* Buttons 4 and 5 are mouse wheel events */
+ lngMouseButtons + 2, /* Buttons 4 and 5 are mouse wheel events */
miPointerGetMotionEvents,
winMouseCtrl,
miPointerGetMotionBufferSize ());
+ free(map);
#if defined(XFree86Server) && defined(XINPUT)
g_winMouseButtonMap = pDeviceInt->button->map;
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index ff18f2e42..3ebd0be7d 100755
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -628,6 +628,16 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
+ case WM_XBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ case WM_XBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+
case WM_MOUSEWHEEL:
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winTopLevelWindowProc - WM_MOUSEWHEEL\n");
diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c
index 00d41d101..0c1ae555c 100755
--- a/hw/xwin/winwin32rootlesswndproc.c
+++ b/hw/xwin/winwin32rootlesswndproc.c
@@ -652,6 +652,18 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
ReleaseCapture ();
return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam);
+ case WM_XBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ case WM_XBUTTONUP:
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture ();
+ return winMouseButtonsHandle (pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+
case WM_MOUSEWHEEL:
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMWindowProc - WM_MOUSEWHEEL\n");
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index e9a644e40..aac3153bf 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -873,6 +873,28 @@ winWindowProc (HWND hwnd, UINT message,
ReleaseCapture ();
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
+ case WM_XBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ case WM_XBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+
case WM_TIMER:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;