emuMB: default to disabled mouse button emulation for touchscreens.

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@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
master
Oliver McFadden 16 years ago committed by Peter Hutterer
parent 99505011d1
commit 801778c310
  1. 5
      man/evdev.man
  2. 6
      src/emuMB.c
  3. 14
      src/evdev.c
  4. 14
      src/evdev.h

@ -76,8 +76,9 @@ indicating that the next button pressed is to be
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q .BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
Enable/disable the emulation of the third (middle) mouse button for mice Enable/disable the emulation of the third (middle) mouse button for mice
which only have two physical buttons. The third button is emulated by which only have two physical buttons. The third button is emulated by
pressing both buttons simultaneously. Default: on, until a middle mouse pressing both buttons simultaneously. Default: off for touchscreens, otherwise
button event is registered. Property: "Evdev Middle Button Emulation". on until a middle mouse button event is registered. Property: "Evdev Middle
Button Emulation".
.TP 7 .TP 7
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q .BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
Sets the timeout (in milliseconds) that the driver waits before deciding Sets the timeout (in milliseconds) that the driver waits before deciding

@ -309,7 +309,11 @@ void
EvdevMBEmuPreInit(InputInfoPtr pInfo) EvdevMBEmuPreInit(InputInfoPtr pInfo)
{ {
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; 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")) if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
{ {

@ -81,20 +81,6 @@
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0]))) #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 MIN_KEYCODE 8
#define GLYPHS_PER_KEY 2 #define GLYPHS_PER_KEY 2
#define AltMask Mod1Mask #define AltMask Mod1Mask

@ -57,6 +57,20 @@
#define EVDEV_MAXBUTTONS 32 #define EVDEV_MAXBUTTONS 32
#define EVDEV_MAXQUEUE 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 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
#define HAVE_PROPERTIES 1 #define HAVE_PROPERTIES 1
#endif #endif

Loading…
Cancel
Save