diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-28 09:47:17 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-31 11:01:26 +1000 |
commit | 21a2ac818e75ef918d320ce1e88b6263e68e598d (patch) | |
tree | 35abac3ad12f84520bfd24260019a63c6e56e30d | |
parent | 4c216242404d749b9ae8ec181146689f89119cb4 (diff) |
Disable middle mouse button emulation by default.
The AUTO feature was the default, MB emulation was on until a middle mouse
button was pressed. MB emulation however results in a delay of the first
press, causing minor annoyances to the users and being generally confusing
when the behaviour before a button press is different to after a button
pres.
Disable the feature by default instead. There's not a lot of two-button mice
around anymore though and the inability to detect two-button mice makes for
non-deterministic detection of when the emulation should be on.
Middle button emulation can be enabled with a configuration snippet:
Section "InputClass"
Identifier "middle button emulation"
MatchIsPointer "on"
Option "Emulate3Buttons" "on"
EndSection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | man/evdev.man | 3 | ||||
-rw-r--r-- | src/emuMB.c | 38 | ||||
-rw-r--r-- | src/evdev.h | 1 |
3 files changed, 4 insertions, 38 deletions
diff --git a/man/evdev.man b/man/evdev.man index 49ab12c..1a93483 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -76,8 +76,7 @@ indicating that the next button pressed is to be .BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q Enable/disable the emulation of the third (middle) mouse button for mice which only have two physical buttons. The third button is emulated by -pressing both buttons simultaneously. Default: off for touchscreens, otherwise -on until a middle mouse button event is registered. Property: "Evdev Middle +pressing both buttons simultaneously. Default: off. Property: "Evdev Middle Button Emulation". .TP 7 .BI "Option \*qEmulate3Timeout\*q \*q" integer \*q diff --git a/src/emuMB.c b/src/emuMB.c index c33ea8e..764b30e 100644 --- a/src/emuMB.c +++ b/src/emuMB.c @@ -43,12 +43,6 @@ #include <evdev-properties.h> -enum { - MBEMU_DISABLED = 0, - MBEMU_ENABLED, - MBEMU_AUTO -}; - #ifdef HAVE_PROPERTIES static Atom prop_mbemu = 0; /* Middle button emulation on/off property */ static Atom prop_mbtimeout = 0; /* Middle button timeout property */ @@ -232,11 +226,6 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) if (!pEvdev->emulateMB.enabled) return ret; - if (button == 2) { - EvdevMBEmuEnable(pInfo, FALSE); - return ret; - } - /* don't care about other buttons */ if (button != 1 && button != 3) return ret; @@ -311,20 +300,9 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo) { EvdevPtr pEvdev = (EvdevPtr)pInfo->private; - if (pEvdev->flags & EVDEV_TOUCHSCREEN) - pEvdev->emulateMB.enabled = MBEMU_DISABLED; - else - pEvdev->emulateMB.enabled = MBEMU_AUTO; - - if (xf86FindOption(pInfo->options, "Emulate3Buttons")) - { - pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options, - "Emulate3Buttons", - MBEMU_ENABLED); - xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation %s.\n", - pInfo->name, (pEvdev->emulateMB.enabled) ? "on" : "off"); - } - + pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options, + "Emulate3Buttons", + FALSE); pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options, "Emulate3Timeout", 50); } @@ -352,16 +330,6 @@ EvdevMBEmuFinalize(InputInfoPtr pInfo) } -/* Enable/disable middle mouse button emulation. */ -void -EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable) -{ - EvdevPtr pEvdev = (EvdevPtr)pInfo->private; - if (pEvdev->emulateMB.enabled == MBEMU_AUTO) - pEvdev->emulateMB.enabled = enable; -} - - #ifdef HAVE_PROPERTIES static int EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, diff --git a/src/evdev.h b/src/evdev.h index 8c89f83..4945140 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -214,7 +214,6 @@ void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer); void EvdevMBEmuPreInit(InputInfoPtr); void EvdevMBEmuOn(InputInfoPtr); void EvdevMBEmuFinalize(InputInfoPtr); -void EvdevMBEmuEnable(InputInfoPtr, BOOL); /* Mouse Wheel emulation */ void EvdevWheelEmuPreInit(InputInfoPtr pInfo); |