aboutsummaryrefslogtreecommitdiff
path: root/x11-drivers/xf86-input-mouse
diff options
context:
space:
mode:
authorNiclas Zeising <zeising@FreeBSD.org>2013-05-25 14:37:02 +0000
committerNiclas Zeising <zeising@FreeBSD.org>2013-05-25 14:37:02 +0000
commit92ea0d614b10bd99ce43a611721c7c4003cd79a5 (patch)
treecf13f962932aab3646f0af684b2923c4e0f0825b /x11-drivers/xf86-input-mouse
parentffbb85145227efbc987e5d09cab804f896bf37f5 (diff)
downloadports-92ea0d614b10bd99ce43a611721c7c4003cd79a5.tar.gz
ports-92ea0d614b10bd99ce43a611721c7c4003cd79a5.zip
The FreeBSD x11 team proudly presents
an zeising, kwm, miwi, bapt, eadler production: Xorg 7.7 Starring: xserver 1.12.4 (new xorg only) Mesa 8.0.4, including libGL, libGLU and dri (new xorg only) libX11 1.5.0 libxcb 1.9 libdrm 2.4.42 (new xorg only) freeglut 2.8.1 Also starring: Updates to drivers and other libraries and utilities Additional notes: Change pkgconf to be a build dependency. Add a new USE_XORG, xcb, to depend on libxcb and update all ports to use this. Trim makefile headers. Take maintanership of x11/xcb-proto, ok'd by ashish. If you are running WITH_NEW_XORG=, you need to rebuild all installed drivers, see UPDATING for more information. Various fixes to make ports compile. PR: ports/177942 Exp-run by: miwi Approved by: portmgr (miwi) Thanks to all who helped testing!
Notes
Notes: svn path=/head/; revision=319055
Diffstat (limited to 'x11-drivers/xf86-input-mouse')
-rw-r--r--x11-drivers/xf86-input-mouse/Makefile8
-rw-r--r--x11-drivers/xf86-input-mouse/distinfo4
-rw-r--r--x11-drivers/xf86-input-mouse/files/patch-src-bsd_mouse.c271
-rw-r--r--x11-drivers/xf86-input-mouse/files/patch-src_Makefile.in11
-rw-r--r--x11-drivers/xf86-input-mouse/files/patch-src_mouse.c189
-rw-r--r--x11-drivers/xf86-input-mouse/files/patch-src_mouse.h25
-rw-r--r--x11-drivers/xf86-input-mouse/files/patch-src_mousePriv.h11
-rw-r--r--x11-drivers/xf86-input-mouse/pkg-plist3
8 files changed, 364 insertions, 158 deletions
diff --git a/x11-drivers/xf86-input-mouse/Makefile b/x11-drivers/xf86-input-mouse/Makefile
index 42ee890b0afe..cabe85a8eb0b 100644
--- a/x11-drivers/xf86-input-mouse/Makefile
+++ b/x11-drivers/xf86-input-mouse/Makefile
@@ -1,18 +1,14 @@
-# Created by: Florent Thoumie <flz@FreeBSD.org>
# $FreeBSD$
PORTNAME= xf86-input-mouse
-PORTVERSION= 1.7.1
-PORTREVISION= 1
+PORTVERSION= 1.9.0
CATEGORIES= x11-drivers
MAINTAINER= x11@FreeBSD.org
COMMENT= X.Org mouse input driver
-CONFIGURE_ARGS+=--disable-silent-rules
-
XORG_CAT= driver
-USE_XORG= xextproto videoproto
+USES= pathfix
MAN4= mousedrv.4x
.include <bsd.port.mk>
diff --git a/x11-drivers/xf86-input-mouse/distinfo b/x11-drivers/xf86-input-mouse/distinfo
index 890cfcb50773..00bb525f0db8 100644
--- a/x11-drivers/xf86-input-mouse/distinfo
+++ b/x11-drivers/xf86-input-mouse/distinfo
@@ -1,2 +1,2 @@
-SHA256 (xorg/driver/xf86-input-mouse-1.7.1.tar.bz2) = d2c5b4b9bf03f8f7ef7b37bab25197d3f99a4d889c61bb67a68df33ec2c2ff12
-SIZE (xorg/driver/xf86-input-mouse-1.7.1.tar.bz2) = 319429
+SHA256 (xorg/driver/xf86-input-mouse-1.9.0.tar.bz2) = 5d601e4bae53d5e9ead4ecd700f1beb5aeaf78b79e634c4aa381a9ce00276488
+SIZE (xorg/driver/xf86-input-mouse-1.9.0.tar.bz2) = 353339
diff --git a/x11-drivers/xf86-input-mouse/files/patch-src-bsd_mouse.c b/x11-drivers/xf86-input-mouse/files/patch-src-bsd_mouse.c
index b1da04c548d7..078d52a28128 100644
--- a/x11-drivers/xf86-input-mouse/files/patch-src-bsd_mouse.c
+++ b/x11-drivers/xf86-input-mouse/files/patch-src-bsd_mouse.c
@@ -1,64 +1,57 @@
---- src/bsd_mouse.c.orig 2008-11-26 23:11:36.000000000 -0500
-+++ src/bsd_mouse.c 2009-04-07 17:10:17.000000000 -0400
-@@ -1,4 +1,3 @@
--
- /*
- * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
- *
-@@ -71,15 +70,20 @@
+--- src/bsd_mouse.c.orig 2012-07-27 08:10:56.000000000 +0200
++++ src/bsd_mouse.c 2012-07-30 00:49:09.000000000 +0200
+@@ -71,15 +71,20 @@
static const char *FindDevice(InputInfoPtr, const char *, int);
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-+#if !defined(XPS2_SUPPORT) && (__FreeBSD_kernel_version >= 700106)
++#if !defined(XPS2_SUPPORT)
+#define XPS2_SUPPORT
+#endif
/* These are for FreeBSD and DragonFly */
- #define DEFAULT_MOUSE_DEV "/dev/mouse"
- #define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
- #define DEFAULT_PS2_DEV "/dev/psm0"
-+#define DEFAULT_USB_DEV "/dev/ums0"
+ #define DEFAULT_MOUSE_DEV "/dev/mouse"
+ #define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
+ #define DEFAULT_PS2_DEV "/dev/psm0"
++#define DEFAULT_USB_DEV "/dev/ums0"
static const char *mouseDevs[] = {
- DEFAULT_MOUSE_DEV,
- DEFAULT_SYSMOUSE_DEV,
- DEFAULT_PS2_DEV,
-+ DEFAULT_USB_DEV,
- NULL
+ DEFAULT_MOUSE_DEV,
+ DEFAULT_SYSMOUSE_DEV,
+ DEFAULT_PS2_DEV,
++ DEFAULT_USB_DEV,
+ NULL
};
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
-@@ -100,7 +104,11 @@
+@@ -100,7 +105,11 @@
#if defined(__NetBSD__)
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
- return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 |
+#ifdef XPS2_SUPPORT
-+ MSE_XPS2 |
++ MSE_XPS2 |
+#endif
-+ MSE_AUTO | MSE_MISC;
++ MSE_AUTO | MSE_MISC;
#else
- return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO | MSE_MISC;
#endif
-@@ -179,10 +187,31 @@
- { MOUSE_PROTO_THINK, "ThinkingMouse" },
- { MOUSE_PROTO_SYSMOUSE, "SysMouse" }
+@@ -180,9 +189,30 @@
+ { MOUSE_PROTO_SYSMOUSE, "SysMouse" }
};
--
-+
+
+#ifdef XPS2_SUPPORT
+static struct {
-+ int dmodel;
-+ char *name;
++ int dmodel;
++ char *name;
+} ps2proto[] = {
-+ { MOUSE_MODEL_NETSCROLL, "NetScrollPS/2" },
-+ { MOUSE_MODEL_NET, "NetMousePS/2" },
-+ { MOUSE_MODEL_GLIDEPOINT, "GlidePointPS/2" },
-+ { MOUSE_MODEL_THINK, "ThinkingMousePS/2" },
-+ { MOUSE_MODEL_INTELLI, "IMPS/2" },
-+ { MOUSE_MODEL_MOUSEMANPLUS, "MouseManPlusPS/2" },
-+ { MOUSE_MODEL_EXPLORER, "ExplorerPS/2" },
-+ { MOUSE_MODEL_4D, "IMPS/2" },
-+ { MOUSE_MODEL_4DPLUS, "IMPS/2" },
++ { MOUSE_MODEL_NETSCROLL, "NetScrollPS/2" },
++ { MOUSE_MODEL_NET, "NetMousePS/2" },
++ { MOUSE_MODEL_GLIDEPOINT, "GlidePointPS/2" },
++ { MOUSE_MODEL_THINK, "ThinkingMousePS/2" },
++ { MOUSE_MODEL_INTELLI, "IMPS/2" },
++ { MOUSE_MODEL_MOUSEMANPLUS, "MouseManPlusPS/2" },
++ { MOUSE_MODEL_EXPLORER, "ExplorerPS/2" },
++ { MOUSE_MODEL_4D, "IMPS/2" },
++ { MOUSE_MODEL_4DPLUS, "IMPS/2" },
+};
+#endif
+
@@ -72,56 +65,52 @@
int i;
mousehw_t hw;
mousemode_t mode;
-@@ -190,10 +219,16 @@
+@@ -190,7 +220,13 @@
if (pInfo->fd == -1)
- return NULL;
+ return NULL;
+#ifdef XPS2_SUPPORT
/* set the driver operation level, if applicable */
+ dev = xf86FindOptionValue(pInfo->options, "Device");
+ if (dev != NULL && !strncmp(dev, DEFAULT_PS2_DEV, 8))
-+ i = 2;
++ i = 2;
+ else
+#endif
i = 1;
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
--
-+
- /* interrogate the driver and get some intelligence on the device. */
- hw.iftype = MOUSE_IF_UNKNOWN;
- hw.model = MOUSE_MODEL_GENERIC;
-@@ -209,9 +244,18 @@
- protoPara[0] = mode.syncmask[0];
- protoPara[1] = mode.syncmask[1];
- }
-+ proto = devproto[i].name;
+
+@@ -209,9 +245,18 @@
+ protoPara[0] = mode.syncmask[0];
+ protoPara[1] = mode.syncmask[1];
+ }
++ proto = devproto[i].name;
+#ifdef XPS2_SUPPORT
-+ if (mode.protocol == MOUSE_PROTO_PS2)
-+ for (i = 0; i < sizeof(ps2proto)/sizeof(ps2proto[0]); ++i)
-+ if (hw.model == ps2proto[i].dmodel) {
-+ proto = ps2proto[i].name;
-+ break;
-+ }
++ if (mode.protocol == MOUSE_PROTO_PS2)
++ for (i = 0; i < sizeof(ps2proto)/sizeof(ps2proto[0]); ++i)
++ if (hw.model == ps2proto[i].dmodel) {
++ proto = ps2proto[i].name;
++ break;
++ }
+#endif
- xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
-- pInfo->name, devproto[i].name);
-- return devproto[i].name;
-+ pInfo->name, proto);
-+ return proto;
- }
- }
+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
+- pInfo->name, devproto[i].name);
+- return devproto[i].name;
++ pInfo->name, proto);
++ return proto;
+ }
+ }
}
-@@ -234,41 +278,41 @@
- (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
- /*
- * As the FreeBSD sysmouse driver defaults to protocol level 0
-- * everytime it is opened we enforce protocol level 1 again at
-+ * everytime it is closed we enforce protocol level 1 again at
- * this point.
- */
- mode.level = 1;
+@@ -234,41 +279,41 @@
+ (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
+ /*
+ * As the FreeBSD sysmouse driver defaults to protocol level 0
+- * everytime it is opened we enforce protocol level 1 again at
++ * everytime it is closed we enforce protocol level 1 again at
+ * this point.
+ */
+ mode.level = 1;
} else
-- mode.level = -1;
+- mode.level = -1;
-#else
- mode.level = -1;
#endif
@@ -151,26 +140,26 @@
+ unsigned int i;
- if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) {
-- if (fscanf(f, "%u", &pid) == 1 && pid > 0) {
-- if (kill(pid, 0) == 0) {
-- fclose(f);
-- return TRUE;
-- }
+- if (fscanf(f, "%u", &pid) == 1 && pid > 0) {
+- if (kill(pid, 0) == 0) {
+- fclose(f);
+- return TRUE;
+- }
+ if (dev)
-+ sprintf(cmd, "sh -c 'fstat %s | grep -c moused' 2>/dev/null", dev);
++ sprintf(cmd, "sh -c 'fstat %s | grep -c moused' 2>/dev/null", dev);
+ else
-+ sprintf(cmd, "sh -c 'pgrep -nx moused' 2>/dev/null");
++ sprintf(cmd, "sh -c 'pgrep -nx moused' 2>/dev/null");
+ if ((f = popen(cmd, "r")) != NULL) {
-+ if (fscanf(f, "%u", &i) == 1 && i > 0) {
-+ pclose(f);
-+ return TRUE;
- }
-- fclose(f);
-+ pclose(f);
++ if (fscanf(f, "%u", &i) == 1 && i > 0) {
++ pclose(f);
++ return TRUE;
+ }
+- fclose(f);
++ pclose(f);
}
return FALSE;
}
-@@ -276,17 +320,17 @@
+@@ -276,17 +321,17 @@
static const char *
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
{
@@ -182,63 +171,63 @@
struct stat sb;
for (pdev = mouseDevs; *pdev; pdev++) {
-- SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
-- if (fd == -1) {
-+ SYSCALL (ret = stat(*pdev, &sb));
-+ if (ret == -1) {
+- SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+- if (fd == -1) {
++ SYSCALL (ret = stat(*pdev, &sb));
++ if (ret == -1) {
#ifdef DEBUG
-- ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
-+ ErrorF("Cannot stat %s (%s)\n", *pdev, strerror(errno));
+- ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
++ ErrorF("Cannot stat %s (%s)\n", *pdev, strerror(errno));
#endif
- } else {
- /*
-@@ -295,28 +339,32 @@
- * the test for whether /dev/sysmouse is usable can be made.
- */
- if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
-- if (fstat(fd, &devMouseStat) == 0)
-- devMouse = TRUE;
-- close(fd);
-+ memcpy(&devMouseStat, &sb, sizeof(devMouseStat));
-+ devMouse = TRUE;
- continue;
- } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
- /* Check if /dev/mouse is the same as /dev/sysmouse. */
-- if (devMouse && fstat(fd, &sb) == 0 &&
-- devMouseStat.st_dev == sb.st_dev &&
-+ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
- devMouseStat.st_ino == sb.st_ino) {
- /* If the same, use /dev/sysmouse. */
- devMouse = FALSE;
- }
-- close(fd);
-- if (MousedRunning())
-+ if (MousedRunning(NULL))
- break;
-- else {
+ } else {
+ /*
+@@ -295,28 +340,32 @@
+ * the test for whether /dev/sysmouse is usable can be made.
+ */
+ if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
+- if (fstat(fd, &devMouseStat) == 0)
+- devMouse = TRUE;
+- close(fd);
++ memcpy(&devMouseStat, &sb, sizeof(devMouseStat));
++ devMouse = TRUE;
+ continue;
+ } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
+ /* Check if /dev/mouse is the same as /dev/sysmouse. */
+- if (devMouse && fstat(fd, &sb) == 0 &&
+- devMouseStat.st_dev == sb.st_dev &&
++ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
+ devMouseStat.st_ino == sb.st_ino) {
+ /* If the same, use /dev/sysmouse. */
+ devMouse = FALSE;
+ }
+- close(fd);
+- if (MousedRunning())
++ if (MousedRunning(NULL))
+ break;
+- else {
-#ifdef DEBUG
-- ErrorF("moused isn't running\n");
+- ErrorF("moused isn't running\n");
-#endif
-- }
- } else {
-- close(fd);
-+ /* Check if /dev/mouse is the same as this device. */
-+ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
-+ devMouseStat.st_ino == sb.st_ino) {
-+ /* If the same, use this device. */
-+ devMouse = FALSE;
-+ }
-+ if (MousedRunning(*pdev))
-+ continue;
-+ /* ums(4) does not support anything but SysMouse protocol. */
-+ if (!strncmp(*pdev, DEFAULT_USB_DEV, 8) && protocol &&
-+ xf86NameCmp(protocol, "auto") != 0 &&
-+ xf86NameCmp(protocol, "sysmouse") != 0)
-+ continue;
- break;
- }
- }
-@@ -782,7 +830,9 @@
+- }
+ } else {
+- close(fd);
++ /* Check if /dev/mouse is the same as this device. */
++ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
++ devMouseStat.st_ino == sb.st_ino) {
++ /* If the same, use this device. */
++ devMouse = FALSE;
++ }
++ if (MousedRunning(*pdev))
++ continue;
++ /* ums(4) does not support anything but SysMouse protocol. */
++ if (!strncmp(*pdev, DEFAULT_USB_DEV, 8) && protocol &&
++ xf86NameCmp(protocol, "auto") != 0 &&
++ xf86NameCmp(protocol, "sysmouse") != 0)
++ continue;
+ break;
+ }
+ }
+@@ -764,7 +813,9 @@
p->CheckProtocol = CheckProtocol;
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
p->SetupAuto = SetupAuto;
diff --git a/x11-drivers/xf86-input-mouse/files/patch-src_Makefile.in b/x11-drivers/xf86-input-mouse/files/patch-src_Makefile.in
new file mode 100644
index 000000000000..5b1c89921ea5
--- /dev/null
+++ b/x11-drivers/xf86-input-mouse/files/patch-src_Makefile.in
@@ -0,0 +1,11 @@
+--- ./src/Makefile.in.orig 2011-07-05 18:09:54.000000000 +0200
++++ ./src/Makefile.in 2012-03-02 14:02:43.000000000 +0100
+@@ -279,7 +279,7 @@
+ # _ladir passes a dummy rpath to libtool so the thing will actually link
+ # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+ @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
+-@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
++@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version -lusbhid
+ @DRIVER_NAME@_drv_ladir = @inputdir@
+
+ # We have to list all the mouse drivers here, even if we don't build them, so
diff --git a/x11-drivers/xf86-input-mouse/files/patch-src_mouse.c b/x11-drivers/xf86-input-mouse/files/patch-src_mouse.c
index 8255608025a1..2d363d50c7b2 100644
--- a/x11-drivers/xf86-input-mouse/files/patch-src_mouse.c
+++ b/x11-drivers/xf86-input-mouse/files/patch-src_mouse.c
@@ -1,11 +1,182 @@
---- src/mouse.c.orig 2012-10-18 11:06:28.000000000 +0400
-+++ src/mouse.c 2012-10-18 11:06:57.000000000 +0400
-@@ -872,6 +872,8 @@ MousePreInit(InputDriverPtr drv, IDevPtr
- pInfo->private_flags = 0;
- pInfo->always_core_feedback = NULL;
+--- src/mouse.c.orig 2012-07-27 08:10:56.000000000 +0200
++++ src/mouse.c 2012-07-30 00:31:48.000000000 +0200
+@@ -280,13 +280,39 @@
-+ COLLECT_INPUT_OPTIONS(pInfo, NULL);
+ pMse = pInfo->private;
+
+- pMse->buttons = xf86SetIntOption(pInfo->options, "Buttons", 0);
++ i = xf86SetIntOption(pInfo->options, "Buttons", 0);
++ if (i != 0)
++ pMse->buttons = i;
+ if (!pMse->buttons) {
+ pMse->buttons = MSE_DFLTBUTTONS;
+ buttons_from = X_DEFAULT;
+ }
+ origButtons = pMse->buttons;
+
++ s = xf86SetStrOption(pInfo->options, "ButtonMapping", NULL);
++ if (s) {
++ int b, n = 0;
++ char *s1 = s;
++ /* keep getting numbers which are buttons */
++ while (s1 && n < MSE_MAXBUTTONS && (b = strtol(s1, &s1, 10)) != 0) {
++ /* check sanity for a button */
++ if (b < 0 || b > MSE_MAXBUTTONS) {
++ xf86Msg(X_WARNING,
++ "ButtonMapping: Invalid button number = %d\n", b);
++ break;
++ };
++ pMse->buttonMap[n++] = 1 << (b-1);
++ if (b > pMse->buttons) pMse->buttons = b;
++ }
++ free(s);
++ }
++ /* get maximum of mapped buttons */
++ for (i = pMse->buttons-1; i >= 0; i--) {
++ int f = ffs (pMse->buttonMap[i]);
++ if (f > pMse->buttons)
++ pMse->buttons = f;
++ }
+
- if (NewMousePreInit(drv, pInfo, flags) == Success)
- {
- /* Check if SendDragEvents has been disabled. */
+ pMse->emulate3Buttons = xf86SetBoolOption(pInfo->options,
+ "Emulate3Buttons", FALSE);
+ if (!xf86FindOptionValue(pInfo->options,"Emulate3Buttons")) {
+@@ -298,6 +324,8 @@
+ "Emulate3Timeout", 50);
+ if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
+ MessageType from = X_CONFIG;
++ if (pMse->buttons < 3)
++ pMse->buttons = 3;
+ if (pMse->emulate3ButtonsSoft)
+ from = X_DEFAULT;
+ xf86Msg(from, "%s: Emulate3Buttons, Emulate3Timeout: %d\n",
+@@ -305,6 +333,8 @@
+ }
+
+ pMse->chordMiddle = xf86SetBoolOption(pInfo->options, "ChordMiddle", FALSE);
++ if (pMse->chordMiddle && pMse->buttons < 3)
++ pMse->buttons = 3;
+ pMse->flipXY = xf86SetBoolOption(pInfo->options, "FlipXY", FALSE);
+ if (xf86SetBoolOption(pInfo->options, "InvX", FALSE)) {
+ pMse->invX = -1;
+@@ -315,7 +345,7 @@
+ } else
+ pMse->invY = 1;
+ pMse->angleOffset = xf86SetIntOption(pInfo->options, "AngleOffset", 0);
+-
++ pMse->sensitivity = xf86SetRealOption(pInfo->options, "Sensitivity", 1.0);
+
+ if (pMse->pDragLock)
+ free(pMse->pDragLock);
+@@ -425,14 +455,17 @@
+ free(s);
+ }
+
+- s = xf86SetStrOption(pInfo->options, "ZAxisMapping", "4 5");
++ s = xf86SetStrOption(pInfo->options, "ZAxisMapping",
++ pMse->hasZ ? ( pMse->hasW ? "4 5 6 7" : "4 5" ) : "off");
+ if (s) {
+ int b1 = 0, b2 = 0, b3 = 0, b4 = 0;
+ char *msg = NULL;
+
+ pMse->negativeZ = pMse->positiveZ = MSE_NOAXISMAP;
+ pMse->negativeW = pMse->positiveW = MSE_NOAXISMAP;
+- if (!xf86NameCmp(s, "x")) {
++ if (!xf86NameCmp(s, "off")) {
++ msg = xstrdup("off");
++ } else if (!xf86NameCmp(s, "x")) {
+ pMse->negativeZ = pMse->positiveZ = MSE_MAPTOX;
+ msg = xstrdup("X axis");
+ } else if (!xf86NameCmp(s, "y")) {
+@@ -568,29 +601,6 @@
+ pInfo->name, wheelButton, pMse->wheelInertia,
+ pMse->wheelButtonTimeout);
+ }
+- s = xf86SetStrOption(pInfo->options, "ButtonMapping", NULL);
+- if (s) {
+- int b, n = 0;
+- char *s1 = s;
+- /* keep getting numbers which are buttons */
+- while (s1 && n < MSE_MAXBUTTONS && (b = strtol(s1, &s1, 10)) != 0) {
+- /* check sanity for a button */
+- if (b < 0 || b > MSE_MAXBUTTONS) {
+- xf86Msg(X_WARNING,
+- "ButtonMapping: Invalid button number = %d\n", b);
+- break;
+- };
+- pMse->buttonMap[n++] = 1 << (b-1);
+- if (b > pMse->buttons) pMse->buttons = b;
+- }
+- free(s);
+- }
+- /* get maximum of mapped buttons */
+- for (i = pMse->buttons-1; i >= 0; i--) {
+- int f = ffs (pMse->buttonMap[i]);
+- if (f > pMse->buttons)
+- pMse->buttons = f;
+- }
+ if (origButtons != pMse->buttons)
+ buttons_from = X_CONFIG;
+ xf86Msg(buttons_from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
+@@ -668,7 +678,6 @@
+ }
+ pMse->sampleRate = xf86SetIntOption(pInfo->options, "SampleRate", 0);
+ pMse->resolution = xf86SetIntOption(pInfo->options, "Resolution", 0);
+- mPriv->sensitivity = xf86SetRealOption(pInfo->options, "Sensitivity", 1.0);
+ }
+
+ static void
+@@ -959,6 +968,8 @@
+ /* Default Mapping: 1 2 3 8 9 10 11 ... */
+ for (i = 0; i < MSE_MAXBUTTONS; i++)
+ pMse->buttonMap[i] = 1 << (i > 2 && i < MSE_MAXBUTTONS-4 ? i+4 : i);
++ pMse->hasZ = 1;
++ pMse->hasW = 0;
+
+ protocol = MousePickProtocol(pInfo, device, protocol, &protocolID);
+
+@@ -2137,7 +2148,7 @@
+
+ if (pMse->emulateWheel) {
+ /* Emulate wheel button handling */
+- if(pMse->wheelButton == 0)
++ if (pMse->wheelButton == 0)
+ wheelButtonMask = 0;
+ else
+ wheelButtonMask = 1 << (pMse->wheelButton - 1);
+@@ -2221,6 +2232,9 @@
+ }
+ }
+ }
++ } else {
++ pMse->wheelXDistance = 0;
++ pMse->wheelYDistance = 0;
+ }
+
+ /* Absorb the mouse movement while the wheel button is pressed. */
+@@ -2238,7 +2252,7 @@
+ if (pMse->emulate3ButtonsSoft && pMse->emulate3Pending && (dx || dy))
+ buttonTimer(pInfo);
+
+- if (dx || dy)
++ if ((dx || dy) && !pMse->disableXY)
+ xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
+
+ if (change) {
+@@ -2448,11 +2462,11 @@
+
+ /* Accumulate the scaled dx, dy in the private variables
+ fracdx,fracdy and return the integer number part */
+- if (mousepriv) {
+- mousepriv->fracdx += mousepriv->sensitivity*dx;
+- mousepriv->fracdy += mousepriv->sensitivity*dy;
+- mousepriv->fracdx -= ( dx=(int)(mousepriv->fracdx) );
+- mousepriv->fracdy -= ( dy=(int)(mousepriv->fracdy) );
++ if (pMse->sensitivity != 0) {
++ pMse->fracdx += pMse->sensitivity*dx;
++ pMse->fracdy += pMse->sensitivity*dy;
++ pMse->fracdx -= ( dx=(int)(pMse->fracdx) );
++ pMse->fracdy -= ( dy=(int)(pMse->fracdy) );
+ }
+
+ /* If mouse wheel movement has to be mapped on a button, we need to
diff --git a/x11-drivers/xf86-input-mouse/files/patch-src_mouse.h b/x11-drivers/xf86-input-mouse/files/patch-src_mouse.h
new file mode 100644
index 000000000000..abb2ac9565b2
--- /dev/null
+++ b/x11-drivers/xf86-input-mouse/files/patch-src_mouse.h
@@ -0,0 +1,25 @@
+--- src/mouse.h.orig 2012-07-27 08:10:56.000000000 +0200
++++ src/mouse.h 2012-07-30 00:41:02.000000000 +0200
+@@ -217,10 +217,13 @@
+ Bool emulate3ButtonsSoft;
+ int emulate3Timeout;/* Timeout for 3 button emulation */
+ Bool chordMiddle;
++ Bool disableXY;
+ Bool flipXY;
+ int invX;
+ int invY;
+ int resolution;
++ Bool hasW;
++ Bool hasZ;
+ int negativeZ; /* button mask */
+ int positiveZ; /* button mask */
+ int negativeW; /* button mask */
+@@ -259,6 +262,8 @@
+ int doubleClickOldSourceState;
+ int lastMappedButtons;
+ int buttonMap[MSE_MAXBUTTONS];
++ float fracdx,fracdy;
++ float sensitivity;
+ } MouseDevRec, *MouseDevPtr;
+
+ #endif /* _XF86OSMOUSE_H_ */
diff --git a/x11-drivers/xf86-input-mouse/files/patch-src_mousePriv.h b/x11-drivers/xf86-input-mouse/files/patch-src_mousePriv.h
new file mode 100644
index 000000000000..8abb8c3e83fc
--- /dev/null
+++ b/x11-drivers/xf86-input-mouse/files/patch-src_mousePriv.h
@@ -0,0 +1,11 @@
+--- src/mousePriv.h.orig 2012-07-27 08:10:56.000000000 +0200
++++ src/mousePriv.h 2012-07-30 00:39:00.000000000 +0200
+@@ -63,8 +63,6 @@
+ int acc;
+ CARD32 pnpLast;
+ Bool disablePnPauto;
+- float fracdx,fracdy;
+- float sensitivity;
+ } mousePrivRec, *mousePrivPtr;
+
+ /* mouse proto flags */
diff --git a/x11-drivers/xf86-input-mouse/pkg-plist b/x11-drivers/xf86-input-mouse/pkg-plist
index dd465f17a16a..3e9b203c360f 100644
--- a/x11-drivers/xf86-input-mouse/pkg-plist
+++ b/x11-drivers/xf86-input-mouse/pkg-plist
@@ -1,5 +1,8 @@
+include/xorg/xf86-mouse-properties.h
lib/xorg/modules/input/mouse_drv.la
lib/xorg/modules/input/mouse_drv.so
+libdata/pkgconfig/xorg-mouse.pc
@dirrmtry lib/xorg/modules/input
@dirrmtry lib/xorg/modules
@dirrmtry lib/xorg
+@dirrmtry include/xorg