Index: winmouse.c
===================================================================
RCS file: /cvsroot/xoncygwin/xc/programs/Xserver/hw/xwin/winmouse.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 winmouse.c
*** winmouse.c	3 Jun 2003 11:12:55 -0000	1.1.1.2
--- winmouse.c	3 Nov 2003 09:47:48 -0000
***************
*** 34,39 ****
--- 34,46 ----
  
  #include "win.h"
  
+ #if defined(XFree86Server) && defined(XINPUT)
+ #include "inputstr.h"
+ 
+ /* Peek the internal button mapping */
+ static CARD8 *g_winMouseButtonMap = NULL;
+ #endif
+ 
  void
  winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl)
  {
***************
*** 65,70 ****
--- 72,81 ----
  			       miPointerGetMotionEvents,
  			       winMouseCtrl,
  			       miPointerGetMotionBufferSize ());
+ 
+ #if defined(XFree86Server) && defined(XINPUT)
+       g_winMouseButtonMap = pDeviceInt->button->map;
+ #endif
        break;
  
      case DEVICE_ON:
***************
*** 85,91 ****
  winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
  {
    winScreenPriv(pScreen);
!   xEvent		xCurrentEvent;
  
    /* Button4 = WheelUp */
    /* Button5 = WheelDown */
--- 96,102 ----
  winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
  {
    winScreenPriv(pScreen);
!   int button; /* Button4 or Button5 */
  
    /* Button4 = WheelUp */
    /* Button5 = WheelDown */
***************
*** 136,146 ****
    /* Set the button to indicate up or down wheel delta */
    if (iDeltaZ > 0)
      {
!       xCurrentEvent.u.u.detail = Button4;
      }
    else
      {
!       xCurrentEvent.u.u.detail = Button5;
      }
  
    /*
--- 147,157 ----
    /* Set the button to indicate up or down wheel delta */
    if (iDeltaZ > 0)
      {
!       button = Button4;
      }
    else
      {
!       button = Button5;
      }
  
    /*
***************
*** 157,172 ****
    while (iDeltaZ--)
      {
        /* Push the wheel button */
!       xCurrentEvent.u.u.type = ButtonPress;
!       xCurrentEvent.u.keyButtonPointer.time
! 	= g_c32LastInputEventTime = GetTickCount ();
!       mieqEnqueue (&xCurrentEvent);
  
        /* Release the wheel button */
!       xCurrentEvent.u.u.type = ButtonRelease;
!       xCurrentEvent.u.keyButtonPointer.time
! 	= g_c32LastInputEventTime = GetTickCount ();
!       mieqEnqueue (&xCurrentEvent);
      }
  
    return 0;
--- 168,177 ----
    while (iDeltaZ--)
      {
        /* Push the wheel button */
!       winMouseButtonsSendEvent (ButtonPress, button);
  
        /* Release the wheel button */
!       winMouseButtonsSendEvent (ButtonRelease, button);
      }
  
    return 0;
***************
*** 184,190 ****
  
    /* Load an xEvent and enqueue the event */
    xCurrentEvent.u.u.type = iEventType;
!   xCurrentEvent.u.u.detail = iButton;
    xCurrentEvent.u.keyButtonPointer.time
      = g_c32LastInputEventTime = GetTickCount ();
    mieqEnqueue (&xCurrentEvent);
--- 189,200 ----
  
    /* Load an xEvent and enqueue the event */
    xCurrentEvent.u.u.type = iEventType;
! #if defined(XFree86Server) && defined(XINPUT)
!   if (g_winMouseButtonMap)
!     xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
!   else
! #endif
!     xCurrentEvent.u.u.detail = iButton;
    xCurrentEvent.u.keyButtonPointer.time
      = g_c32LastInputEventTime = GetTickCount ();
    mieqEnqueue (&xCurrentEvent);
