[PATCH] emuMB: default to disabled mouse button emulation for touchscreens.

Oliver McFadden oliver.mcfadden at nokia.com
Wed Feb 24 01:09:16 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>
---
 src/emuMB.c |    3 +++
 src/evdev.c |   11 -----------
 src/evdev.h |   11 +++++++++++
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/emuMB.c b/src/emuMB.c
index 199c0d7..14157bf 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -311,6 +311,9 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
     EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
     pEvdev->emulateMB.enabled = MBEMU_AUTO;
 
+    if (pEvdev->flags & EVDEV_TOUCHSCREEN)
+        pEvdev->emulateMB.enabled = MBEMU_DISABLED;
+
     if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
     {
         pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
diff --git a/src/evdev.c b/src/evdev.c
index 5da8960..61917a1 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -80,17 +80,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) /* run-time calibrated? */
-
 #define MIN_KEYCODE 8
 #define GLYPHS_PER_KEY 2
 #define AltMask		Mod1Mask
diff --git a/src/evdev.h b/src/evdev.h
index 38adeaf..ad8f7c0 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -57,6 +57,17 @@
 #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) /* run-time calibrated? */
+
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
 #define HAVE_PROPERTIES 1
 #endif
-- 
1.6.1



More information about the xorg-devel mailing list