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

Oliver McFadden oliver.mcfadden at nokia.com
Wed Feb 24 21:12:11 PST 2010


On Thu, 2010-02-25 at 02:01 +0100, ext Peter Hutterer wrote:
> On Wed, Feb 24, 2010 at 11:39:07AM +0200, Oliver McFadden wrote:
> > 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>
> 
> Please add the man-page addition to document this feature too, the current
> man page still claims it's auto. Other than that, patch is fine but it
> doesn't apply to current git master, so for the final patch please rebase
> your local repo first. I'll push the patch once I have it.
> Thanks.

Okay, the new patch is on it's way. :-)

> 
> Cheers,
>   Peter
> 
> > ---
> > v2: made the if/else explicit (instead of setting to AUTO first, then DISABLED
> > if the device is a touchscreen.)
> > 
> >  src/emuMB.c |    6 +++++-
> >  src/evdev.c |   11 -----------
> >  src/evdev.h |   11 +++++++++++
> >  3 files changed, 16 insertions(+), 12 deletions(-)
> > 
> > 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 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