diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-06-11 11:19:04 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-06-11 11:23:53 +0930 |
commit | 01355b9d4b3ed92da42f90fb69384eb22cdcb3d9 (patch) | |
tree | 69f0c8174e6d8a0d7660eeec2868389ff62b473b | |
parent | 9591dc1f6cc89208805b120eabd055e8dabd3e40 (diff) |
If Emulate3Buttons is specified in the config, don't auto-deactivate it.
Default setting is still "on" until middle button is pressed. If the options
is however explicitly stated in the config file, it takes the value from the
config file, no matter if a middle button is present.
-rw-r--r-- | src/emuMB.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/emuMB.c b/src/emuMB.c index b2974b7..f24a721 100644 --- a/src/emuMB.c +++ b/src/emuMB.c @@ -36,6 +36,12 @@ #include "evdev.h" +enum { + MBEMU_DISABLED = 0, + MBEMU_ENABLED, + MBEMU_AUTO +}; + /* * Lets create a simple finite-state machine for 3 button emulation: * @@ -288,9 +294,17 @@ void EvdevMBEmuPreInit(InputInfoPtr pInfo) { EvdevPtr pEvdev = (EvdevPtr)pInfo->private; + 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.\n", + pInfo->name); + } - pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options, - "Emulate3Buttons", TRUE); pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options, "Emulate3Timeout", 50); RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler, @@ -313,5 +327,6 @@ void EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable) { EvdevPtr pEvdev = (EvdevPtr)pInfo->private; - pEvdev->emulateMB.enabled = enable; + if (pEvdev->emulateMB.enabled == MBEMU_AUTO) + pEvdev->emulateMB.enabled = enable; } |