add support for mice with more than 3 buttons and one scroll wheel (Chris

B)
This commit is contained in:
Alexander Gottwald 2004-09-15 17:58:50 +00:00
parent 516f452e78
commit c4083511ac
7 changed files with 79 additions and 10 deletions

View File

@ -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 2004-08-02 Kensuke Matsuzaki
* winclipboardthread.c winclipboardwndproc.c: * winclipboardthread.c winclipboardwndproc.c:

View File

@ -48,6 +48,17 @@
#define CYGDEBUG NO #define CYGDEBUG NO
#endif #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 NEED_EVENTS
#define WIN_DEFAULT_BPP 0 #define WIN_DEFAULT_BPP 0

View File

@ -523,9 +523,9 @@ static const char *MESSAGE_NAMES[1024] = {
"WM_MBUTTONUP", "WM_MBUTTONUP",
"WM_MBUTTONDBLCLK", "WM_MBUTTONDBLCLK",
"WM_MOUSEWHEEL", "WM_MOUSEWHEEL",
"523", "WM_XBUTTONDOWN",
"524", "WM_XBUTTONUP",
"525", "WM_XBUTTONDBLCLK",
"526", "526",
"527", "527",
"WM_PARENTNOTIFY", "WM_PARENTNOTIFY",

View File

@ -64,23 +64,26 @@ winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl)
int int
winMouseProc (DeviceIntPtr pDeviceInt, int iState) winMouseProc (DeviceIntPtr pDeviceInt, int iState)
{ {
CARD8 map[6]; int lngMouseButtons, i;
CARD8 *map;
DevicePtr pDevice = (DevicePtr) pDeviceInt; DevicePtr pDevice = (DevicePtr) pDeviceInt;
switch (iState) switch (iState)
{ {
case DEVICE_INIT: case DEVICE_INIT:
map[1] = 1; lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
map[2] = 2; ErrorF ("%d mouse buttons found\n", lngMouseButtons);
map[3] = 3; map = malloc(sizeof(CARD8) * (lngMouseButtons + 1 + 2));
map[4] = 4;
map[5] = 5; for (i=1; i <= lngMouseButtons + 2; i++)
map[i] = i;
InitPointerDeviceStruct (pDevice, InitPointerDeviceStruct (pDevice,
map, map,
5, /* Buttons 4 and 5 are mouse wheel events */ lngMouseButtons + 2, /* Buttons 4 and 5 are mouse wheel events */
miPointerGetMotionEvents, miPointerGetMotionEvents,
winMouseCtrl, winMouseCtrl,
miPointerGetMotionBufferSize ()); miPointerGetMotionBufferSize ());
free(map);
#if defined(XFree86Server) && defined(XINPUT) #if defined(XFree86Server) && defined(XINPUT)
g_winMouseButtonMap = pDeviceInt->button->map; g_winMouseButtonMap = pDeviceInt->button->map;

View File

@ -628,6 +628,16 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break; break;
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); 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: case WM_MOUSEWHEEL:
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("winTopLevelWindowProc - WM_MOUSEWHEEL\n"); ErrorF ("winTopLevelWindowProc - WM_MOUSEWHEEL\n");

View File

@ -652,6 +652,18 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
ReleaseCapture (); ReleaseCapture ();
return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam); 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: case WM_MOUSEWHEEL:
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMWindowProc - WM_MOUSEWHEEL\n"); winDebug ("winMWExtWMWindowProc - WM_MOUSEWHEEL\n");

View File

@ -873,6 +873,28 @@ winWindowProc (HWND hwnd, UINT message,
ReleaseCapture (); ReleaseCapture ();
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); 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: case WM_TIMER:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break; break;