2005-11-09  Kean Johnston  <kean@armory.com>

	* programs/Xserver/hw/xfree86/input/mouse/mouse.c: Reinstate the
	default value for ZAxisMapping.
	* programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c: Do
	one-to-one mapping of mouse buttons. Turn wheel motion into a
	Z-axis event instead of treating it directly as a button.
	* programs/Xserver/hw/xfree86/os-support/usl/usl_mouse.c: Ditto.
	* programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.c: Ditto.

Index: programs/Xserver/hw/xfree86/input/mouse/mouse.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v
retrieving revision 1.16
diff -u -3 -p -u -r1.16 mouse.c
--- programs/Xserver/hw/xfree86/input/mouse/mouse.c	9 Nov 2005 21:31:23 -0000	1.16
+++ programs/Xserver/hw/xfree86/input/mouse/mouse.c	10 Nov 2005 00:36:30 -0000
@@ -538,7 +538,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
 	}
     }
 
-    s = xf86SetStrOption(pInfo->options, "ZAxisMapping", 0);
+    s = xf86SetStrOption(pInfo->options, "ZAxisMapping", "4 5 6 7");
     if (s) {
 	int b1 = 0, b2 = 0, b3 = 0, b4 = 0;
 	char *msg = NULL;
Index: programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v
retrieving revision 1.6
diff -u -3 -p -u -r1.6 sco_mouse.c
--- programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c	9 Nov 2005 17:05:41 -0000	1.6
+++ programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c	10 Nov 2005 00:36:30 -0000
@@ -123,14 +123,8 @@ OsMouseProc (DeviceIntPtr pPointer, int 
     }
     xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
 
-    map[1] = 1;
-    map[2] = 2;
-    map[3] = 3;
-    map[4] = 7;
-    map[5] = 8;
-    map[6] = 6;
-    map[7] = 4;
-    map[8] = 5; /* Compatibile with SCO X server */
+    for (evi = 0; evi <= 8; evi++)
+      map[evi] = evi;
 
     InitPointerDeviceStruct((DevicePtr)pPointer, map, 8,
         miPointerGetMotionEvents, pMse->Ctrl,
@@ -185,15 +179,16 @@ OsMouseReadInput (InputInfoPtr pInfo)
 
   while ((evp = ev_read()) != (EVENT *)0) {
     int buttons = EV_BUTTONS(*evp);
-    int dx = EV_DX(*evp), dy = -(EV_DY(*evp));
+    int dx = EV_DX(*evp), dy = -(EV_DY(*evp)), dz = 0;
 
-    if (EV_TAG(*evp) & T_WHEEL) {
-      pMse->PostEvent (pInfo, buttons, 0, 0, 0, 0);
-      /* Simulate button release */
-      buttons &= ~(WHEEL_FWD | WHEEL_BACK);
-    }
+    if (buttons & WHEEL_FWD)
+      dz = -1;
+    else if (buttons & WHEEL_BACK)
+      dz = 1;
+
+    buttons &= ~(WHEEL_FWD | WHEEL_BACK);
 
-    pMse->PostEvent (pInfo, buttons, dx, dy, 0, 0);
+    pMse->PostEvent (pInfo, buttons, dx, dy, dz, 0);
     ev_pop();
   }
 }
Index: programs/Xserver/hw/xfree86/os-support/usl/usl_mouse.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/os-support/usl/usl_mouse.c,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 usl_mouse.c
--- programs/Xserver/hw/xfree86/os-support/usl/usl_mouse.c	8 Nov 2005 06:33:30 -0000	1.2
+++ programs/Xserver/hw/xfree86/os-support/usl/usl_mouse.c	10 Nov 2005 00:36:30 -0000
@@ -86,14 +86,8 @@ OsMouseProc(DeviceIntPtr pPointer, int w
     case DEVICE_INIT: 
       pPointer->public.on = FALSE;
 
-      map[1] = 1;
-      map[2] = 2;
-      map[3] = 3;
-      map[4] = 7;
-      map[5] = 8;
-      map[6] = 6;
-      map[7] = 4;
-      map[8] = 5;
+      for (ret = 0; ret <= 8; ret++)
+	map[ret] = ret;
 
       InitPointerDeviceStruct((DevicePtr)pPointer, map, 8, 
 			      miPointerGetMotionEvents, pMse->Ctrl,
Index: programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.c,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 usl_xqueue.c
--- programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.c	8 Nov 2005 06:33:30 -0000	1.2
+++ programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.c	10 Nov 2005 00:36:30 -0000
@@ -287,15 +287,12 @@ XqSignalHandler (int signo)
 
       case XQ_WHEEL:
 	if (pMse) {
-	  int wbut = pMse->lastButtons;
+	  int wbut = pMse->lastButtons, dz;
 	  if (xqEvents[xqHead].xq_code == 1)
-	    wbut |= 0x80;
+	    dz = 1;
 	  else
-	    wbut |= 0x40;
-	  pMse->PostEvent(xqMouse, wbut, 0, 0, 0, 0);
-	  /* Simulate button release */
-	  wbut &= ~0xc0;
-	  pMse->PostEvent(xqMouse, wbut, 0, 0, 0, 0);
+	    dz = -1;
+	  pMse->PostEvent(xqMouse, wbut, 0, 0, dz, 0);
 	}
 	break;
 