Author: branden
Date: 2003-09-07 04:42:10 -0500 (Sun, 07 Sep 2003)
New Revision: 484

Added:
   trunk/debian/patches/097_mouse_zaxis_mapping_pushes_up_buttons.diff
Modified:
   trunk/debian/changelog
Log:
debian/patches/097_mouse_zaxis_mapping_pushes_up_buttons.diff: add Bartosz
  Zapalowski's patch for supporting wheel mice with large numbers of
  buttons; the ZAxisMapping option "pushes up" the other buttons so that
  the mouse behaves sanely.  This addresses problems with how the X server
  parses wheel data from at least some devices that use the ExplorerPS/2
  protocol. (Closes: #166550)


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2003-09-07 09:20:15 UTC (rev 483)
+++ trunk/debian/changelog      2003-09-07 09:42:10 UTC (rev 484)
@@ -13,8 +13,14 @@
     of the newport driver: depth 8 and resolution 1280x1024 (thanks, Bernhard
     R. Link) (Closes: #208500)
 
- -- Branden Robinson <[EMAIL PROTECTED]>  Wed,  3 Sep 2003 11:28:44 -0500
+  * patch #097: new; add Bartosz Zapalowski's patch for supporting wheel mice
+    with large numbers of buttons; the ZAxisMapping option "pushes up" the
+    other buttons so that the mouse behaves sanely.  This addresses problems
+    with how the X server parses wheel data from at least some devices that
+    use the ExplorerPS/2 protocol. (Closes: #166550)
 
+ -- Branden Robinson <[EMAIL PROTECTED]>  Sun,  7 Sep 2003 04:28:23 -0500
+
 xfree86 (4.2.1-11) unstable; urgency=medium
 
   * urgency set to medium because bug #206790 bites a lot of people (but,

Added: trunk/debian/patches/097_mouse_zaxis_mapping_pushes_up_buttons.diff
===================================================================
--- trunk/debian/patches/097_mouse_zaxis_mapping_pushes_up_buttons.diff 
2003-09-07 09:20:15 UTC (rev 483)
+++ trunk/debian/patches/097_mouse_zaxis_mapping_pushes_up_buttons.diff 
2003-09-07 09:42:10 UTC (rev 484)
@@ -0,0 +1,108 @@
+This patch by Bartosz Zapalowski.
+
+Already submitted upstream; see
+<http://bugs.xfree86.org/show_bug.cgi?id=346>.
+
+diff -ruN xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c 
xc.new/programs/Xserver/hw/xfree86/input/mouse/mouse.c
+--- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c 2001-12-19 
17:05:22.000000000 +0100
++++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c 2003-08-15 
13:55:08.000000000 +0200
+@@ -406,6 +406,45 @@
+                              int i,
+                              pointer LastSelectMask);
+ 
++static void
++MousePrepareShiftData(MouseDevPtr pMse)
++{
++    int wheels = 0;
++    int c, cs = 1, shifted = 0, s, ss, seen, mayshift = 0;
++    
++    if (!pMse->buttonsShiftData)
++      return;
++
++    wheels |= pMse->negativeZ | pMse->positiveZ
++          | pMse->negativeW | pMse->positiveW;
++    
++    for (c = 0; c < pMse->buttons; c++, cs = cs << 1)
++    {
++      if ((wheels & cs) == cs)
++          shifted++;
++      else if (shifted > 0)
++          mayshift++;
++
++      if (shifted == 0)
++          pMse->buttonsShiftData[c] = cs;
++      else {
++          ss = cs;
++          seen = 1;
++          for (s = c; s < pMse->buttons; s++, ss = ss << 1)
++          {
++              if ((wheels & ss) == ss)
++                  continue;
++              if (seen < (shifted + mayshift)) {
++                  seen++;
++                  continue;
++              }
++              pMse->buttonsShiftData[c] = ss;
++              break;
++          }
++      }
++    }
++}
++
+ /* Process options common to all mouse types. */
+ static void
+ MouseCommonOptions(InputInfoPtr pInfo)
+@@ -588,6 +627,10 @@
+     if (origButtons != pMse->buttons)
+       from = X_CONFIG;
+     xf86Msg(from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
++
++    pMse->buttonsShiftData = xcalloc(sizeof(int), pMse->buttons);
++
++    MousePrepareShiftData(pMse);
+     
+ }
+ 
+@@ -2036,6 +2079,23 @@
+     }
+ }
+ 
++static int
++MouseShiftButtons (MouseDevPtr pMse, int buttons)
++{
++    int i, s = 1;
++    int newbuttons = 0;
++    
++    if (!pMse->buttonsShiftData)
++      return buttons;
++
++    for (i = 0; i < pMse->buttons; i++, s = s << 1)  {
++      if (buttons & s)
++          newbuttons |= pMse->buttonsShiftData[i];
++    }
++    
++    return newbuttons;
++}
++
+ static void
+ MousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int 
dw)
+ {
+@@ -2063,6 +2123,7 @@
+       }
+       break;
+     default:  /* buttons */
++      buttons = MouseShiftButtons (pMse, buttons);
+       buttons &= ~(pMse->negativeZ | pMse->positiveZ
+                  | pMse->negativeW | pMse->positiveW);
+       if (dw < 0 || dz < -1)
+diff -ruN xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h 
xc.new/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h
+--- xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h    2001-08-06 
22:51:10.000000000 +0200
++++ xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h    2003-08-13 
16:52:37.000000000 +0200
+@@ -151,6 +151,7 @@
+     int                       positiveY;
+     int                       wheelYDistance;
+     int                       wheelXDistance;
++    int       *               buttonsShiftData;
+ } MouseDevRec, *MouseDevPtr;
+ 
+ /* Z axis mapping */

Reply via email to