---
 xserver/hw/xwin/InitInput.c |    3 +--
 xserver/hw/xwin/winkeybd.c  |   20 ++++++++++++--------
 xserver/hw/xwin/winmouse.c  |   25 +++++++++++++++----------
 3 files changed, 28 insertions(+), 20 deletions(-)

Index: xorg-git/xserver/hw/xwin/InitInput.c
===================================================================
--- xorg-git.orig/xserver/hw/xwin/InitInput.c
+++ xorg-git/xserver/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 ();
Index: xorg-git/xserver/hw/xwin/winkeybd.c
===================================================================
--- xorg-git.orig/xserver/hw/xwin/winkeybd.c
+++ xorg-git/xserver/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)
Index: xorg-git/xserver/hw/xwin/winmouse.c
===================================================================
--- xorg-git.orig/xserver/hw/xwin/winmouse.c
+++ xorg-git/xserver/hw/xwin/winmouse.c
@@ -100,7 +100,6 @@ winMouseProc (DeviceIntPtr pDeviceInt, i
       InitPointerDeviceStruct (pDevice,
 			       map,
 			       lngMouseButtons + lngWheelEvents,
-			       GetMotionHistory,
 			       winMouseCtrl,
 			       GetMotionHistorySize(),
 			       2);
@@ -221,19 +220,25 @@ winMouseWheel (ScreenPtr pScreen, int iD
 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);
 }
 
 

-- 

