[PATCH v3] emuMB: default to disabled mouse button emulation for touchscreens.
Oliver McFadden
oliver.mcfadden at nokia.com
Wed Feb 24 21:11:21 PST 2010
Because touchscreens only use one button (see EvdevProcessKeyEvent())
EvdevMBEmuFilterEvent() never calls EvdevMBEmuEnable(..., FALSE) to
disable emulation. This results in touchscreen devices incurring a delay
of Emulate3Timeout (typically 50 ms.)
Default to MBEMU_DISABLED for touchscreen devices (unless overwritten by
Xorg.conf.)
Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
---
v3: rebased onto evdev master, and added man page documentation.
man/evdev.man | 5 +++--
src/emuMB.c | 6 +++++-
src/evdev.c | 14 --------------
src/evdev.h | 14 ++++++++++++++
4 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/man/evdev.man b/man/evdev.man
index d832a4c..37c11fd 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -76,8 +76,9 @@ 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: on, until a middle mouse
-button event is registered. Property: "Evdev Middle Button Emulation".
+pressing both buttons simultaneously. Default: off for touchscreens, otherwise,
+on, until a middle mouse button event is registered. Property: "Evdev Middle
+Button Emulation".
.TP 7
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
Sets the timeout (in milliseconds) that the driver waits before deciding
diff --git a/src/emuMB.c b/src/emuMB.c
index 199c0d7..113a708 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -309,7 +309,11 @@ void
EvdevMBEmuPreInit(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
- pEvdev->emulateMB.enabled = MBEMU_AUTO;
+
+ if (pEvdev->flags & EVDEV_TOUCHSCREEN)
+ pEvdev->emulateMB.enabled = MBEMU_DISABLED;
+ else
+ pEvdev->emulateMB.enabled = MBEMU_AUTO;
if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
{
diff --git a/src/evdev.c b/src/evdev.c
index 58ffcea..3051462 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -81,20 +81,6 @@
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
-/* evdev flags */
-#define EVDEV_KEYBOARD_EVENTS (1 << 0)
-#define EVDEV_BUTTON_EVENTS (1 << 1)
-#define EVDEV_RELATIVE_EVENTS (1 << 2)
-#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
-#define EVDEV_TOUCHPAD (1 << 4)
-#define EVDEV_INITIALIZED (1 << 5) /* WheelInit etc. called already? */
-#define EVDEV_TOUCHSCREEN (1 << 6)
-#define EVDEV_CALIBRATED (1 << 7) /* run-time calibrated? */
-#define EVDEV_TABLET (1 << 8) /* device looks like a tablet? */
-#define EVDEV_UNIGNORE_ABSOLUTE (1 << 9) /* explicitly unignore abs axes */
-#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
-#define EVDEV_RELATIVE_MODE (1 << 11) /* Force relative events for devices with absolute axes */
-
#define MIN_KEYCODE 8
#define GLYPHS_PER_KEY 2
#define AltMask Mod1Mask
diff --git a/src/evdev.h b/src/evdev.h
index 95d00db..1133985 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -57,6 +57,20 @@
#define EVDEV_MAXBUTTONS 32
#define EVDEV_MAXQUEUE 32
+/* evdev flags */
+#define EVDEV_KEYBOARD_EVENTS (1 << 0)
+#define EVDEV_BUTTON_EVENTS (1 << 1)
+#define EVDEV_RELATIVE_EVENTS (1 << 2)
+#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
+#define EVDEV_TOUCHPAD (1 << 4)
+#define EVDEV_INITIALIZED (1 << 5) /* WheelInit etc. called already? */
+#define EVDEV_TOUCHSCREEN (1 << 6)
+#define EVDEV_CALIBRATED (1 << 7) /* run-time calibrated? */
+#define EVDEV_TABLET (1 << 8) /* device looks like a tablet? */
+#define EVDEV_UNIGNORE_ABSOLUTE (1 << 9) /* explicitly unignore abs axes */
+#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
+#define EVDEV_RELATIVE_MODE (1 << 11) /* Force relative events for devices with absolute axes */
+
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
#define HAVE_PROPERTIES 1
#endif
--
1.6.1
More information about the xorg-devel
mailing list