From 18c1e719e340cce98c99be49827a30a4b9631dde Mon Sep 17 00:00:00 2001 Message-Id: <18c1e719e340cce98c99be49827a30a4b9631dde.1226931512.git.jon.turney@dronecode.org.uk> In-Reply-To: References: From: Jon TURNEY Date: Sun, 2 Nov 2008 18:27:12 +0000 Subject: [PATCH 04/32] Cygwin: update for changes in mieq API Signed-off-by: Jon TURNEY --- hw/xwin/InitInput.c | 3 +-- hw/xwin/winkeybd.c | 20 ++++++++++++-------- hw/xwin/winmouse.c | 25 +++++++++++++++---------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c index d7e3f9c..76c1715 100644 --- a/hw/xwin/InitInput.c +++ b/hw/xwin/InitInput.c @@ -153,8 +153,7 @@ InitInput (int argc, char *argv[]) g_pwinPointer->name = strdup("Windows mouse"); g_pwinKeyboard->name = strdup("Windows keyboard"); - miRegisterPointerDevice (screenInfo.screens[0], pMouse); - mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse); + mieqInit (); /* Initialize the mode key states */ winInitializeModeKeyStates (); diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index d574f20..90cd5af 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -580,7 +580,8 @@ winKeybdReleaseKeys () void winSendKeyEvent (DWORD dwKey, Bool fDown) { - xEvent xCurrentEvent; + EventListPtr events; + int i, nevents; /* * When alt-tabing between screens we can get phantom key up messages @@ -590,14 +591,17 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) /* Update the keyState map */ g_winKeyState[dwKey] = fDown; - - ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); - xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = - g_c32LastInputEventTime = GetTickCount (); - xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE; - mieqEnqueue (&xCurrentEvent); + GetEventList(&events); + nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinKeyboard, events[i].event); + +#if CYGDEBUG + ErrorF("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", + dwKey, fDown, nevents); +#endif } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index be2b66a..04a2ae1 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -100,7 +100,6 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) InitPointerDeviceStruct (pDevice, map, lngMouseButtons + lngWheelEvents, - GetMotionHistory, winMouseCtrl, GetMotionHistorySize(), 2); @@ -221,19 +220,25 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ) void winMouseButtonsSendEvent (int iEventType, int iButton) { - xEvent xCurrentEvent; + EventListPtr events; + int i, nevents; - /* Load an xEvent and enqueue the event */ - xCurrentEvent.u.u.type = iEventType; #if defined(XFree86Server) if (g_winMouseButtonMap) - xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton]; - else + iButton = g_winMouseButtonMap[iButton]; +#endif + + GetEventList(&events); + nevents = GetPointerEvents(events, g_pwinPointer, iEventType, iButton, + POINTER_RELATIVE, 0, 0, NULL); + + for (i = 0; i < nevents; i++) + mieqEnqueue(g_pwinPointer, events[i].event); + +#if CYGDEBUG + ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n", + iEventType, iButton, nevents); #endif - xCurrentEvent.u.u.detail = iButton; - xCurrentEvent.u.keyButtonPointer.time - = g_c32LastInputEventTime = GetTickCount (); - mieqEnqueue (&xCurrentEvent); } -- 1.6.0.2