diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 17:58:50 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 17:58:50 +0000 |
commit | c4083511acd1d0f20a242b8cd3ed62629629ce8f (patch) | |
tree | f2de1942bfaf834842d1bc272653ee53441de663 /hw/xwin | |
parent | 516f452e78170bc643117a71bd2246a83b071316 (diff) |
add support for mice with more than 3 buttons and one scroll wheel (Chris
B)
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/ChangeLog | 11 | ||||
-rw-r--r-- | hw/xwin/win.h | 11 | ||||
-rwxr-xr-x | hw/xwin/winmessages.h | 6 | ||||
-rw-r--r-- | hw/xwin/winmouse.c | 17 | ||||
-rwxr-xr-x | hw/xwin/winmultiwindowwndproc.c | 10 | ||||
-rwxr-xr-x | hw/xwin/winwin32rootlesswndproc.c | 12 | ||||
-rw-r--r-- | hw/xwin/winwndproc.c | 22 |
7 files changed, 79 insertions, 10 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index 2f5584cc0..15bbe93e2 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,14 @@ +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; |