This property enables/disables multi-touch events on a multi-touch device. When MT is disabled, the device behaves like a single touch device. The corresponding xorg.conf option is also added.
Signed-off-by: Ping Cheng <pi...@wacom.com> --- include/wacom-properties.h | 3 +++ man/wacom.man | 3 +++ src/wcmCommon.c | 19 ++++++++++++++++--- src/wcmUSB.c | 9 ++++++--- src/wcmValidateDevice.c | 4 ++++ src/wcmXCommand.c | 18 +++++++++++++++++- src/xf86WacomDefs.h | 3 ++- tools/xsetwacom.c | 10 ++++++++++ 8 files changed, 61 insertions(+), 8 deletions(-) diff --git a/include/wacom-properties.h b/include/wacom-properties.h index 0bb84b1..aa43d4d 100644 --- a/include/wacom-properties.h +++ b/include/wacom-properties.h @@ -77,6 +77,9 @@ #define WACOM_PROP_TOUCH "Wacom Enable Touch" /* 8 bit, 1 values */ +#define WACOM_PROP_ENABLE_MT "Wacom Enable Multi-Touch" + +/* 8 bit, 1 values */ #define WACOM_PROP_ENABLE_GESTURE "Wacom Enable Touch Gesture" /* 32 bit, 3 values, zoom, rotate, tap parameters */ diff --git a/man/wacom.man b/man/wacom.man index 3d4a143..04d84a7 100644 --- a/man/wacom.man +++ b/man/wacom.man @@ -225,6 +225,9 @@ sets the pressure threshold used to generate a button 1 events of stylus. The threshold applies to the normalised pressure range of [0..2048]. The default is 27. .TP 4 +.B Option \fI"Multi-Touch"\fP \fI"bool"\fP +Enable or disable multi-touch events on the device. Default: on. +.TP 4 .B Option \fI"Gesture"\fP \fI"bool"\fP Enable or disable gesture support on the device. Default: off unless the tablet supports multi-touch. diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 0f041e3..cf1e5c2 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1,6 +1,6 @@ /* * Copyright 1995-2002 by Frederic Lepied, France. <lep...@xfree86.org> - * Copyright 2002-2010 by Ping Cheng, Wacom. <pi...@wacom.com> + * Copyright 2002-2012 by Ping Cheng, Wacom. <pi...@wacom.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1009,8 +1009,21 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, pChannel->valid.state = ds; /*save last raw sample */ if (pChannel->nSamples < common->wcmRawSample) ++pChannel->nSamples; - if ((ds.device_type == TOUCH_ID) && common->wcmTouch) - wcmGestureFilter(priv, channel); + if ((ds.device_type == TOUCH_ID) && (common->wcmTouch)) + { + /* enable left click for single touch touchscreen */ +/* if ((!common->wcmMT || + TabletSetFeature(priv->common, WCM_1FGT)) && + TabletHasFeature(priv->common, WCM_LCD)) + { + if (ds.proximity) + pChannel->valid.state.buttons |= 1; + else + pChannel->valid.state.buttons &= ~1; + } + else +*/ wcmGestureFilter(priv, channel); + } /* For touch, only first finger moves the cursor */ if ((ds.device_type == TOUCH_ID && common->wcmTouch && !channel) || diff --git a/src/wcmUSB.c b/src/wcmUSB.c index ba88696..9ace8a1 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -582,6 +582,8 @@ int usbWcmGetRanges(InputInfoPtr pInfo) if (ISBITSET(abs, ABS_MT_SLOT)) { private->wcmUseMT = 1; + if (!common->wcmMT) + private->wcmUseMT = 0; /* pen and MT on the same logical port */ if (ISBITSET(common->wcmKeys, BTN_TOOL_PEN)) @@ -1210,9 +1212,10 @@ static int usbParseKeyEvent(WacomCommonPtr common, case BTN_TOUCH: if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC) { - /* 1FG USB touchscreen */ + /* 1FG USB touchscreen or MT disabled */ if (!TabletHasFeature(common, WCM_PEN) && - TabletHasFeature(common, WCM_1FGT) && + (TabletHasFeature(common, WCM_1FGT) || + !common->wcmMT) && TabletHasFeature(common, WCM_LCD)) { DBG(6, common, @@ -1525,7 +1528,7 @@ static void usbDispatchEvents(InputInfoPtr pInfo) channel_change |= 1; else if (usbParseAbsMTEvent(common, event)) { - if (private->wcmMTChannel == 0) + if (private->wcmMTChannel == 0 || !common->wcmMT) channel_change |= 1; else if (private->wcmMTChannel == 1) mt_channel_change |= 1; diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 0e0e57a..af2653e 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -885,6 +885,10 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, "by a touch tool.\n", pInfo->name); } + /* set MT support on for all devices */ + common->wcmMT = xf86SetBoolOption(pInfo->options, + "MultiTouch", TRUE); + /* 2FG touch device */ if (TabletHasFeature(common, WCM_2FGT)) { diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 40393dc..72fbcb7 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -1,5 +1,5 @@ /* - * Copyright 2007-2010 by Ping Cheng, Wacom. <pi...@wacom.com> + * Copyright 2007-2012 by Ping Cheng, Wacom. <pi...@wacom.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -92,6 +92,7 @@ Atom prop_cursorprox; Atom prop_threshold; Atom prop_suppress; Atom prop_touch; +Atom prop_mt; Atom prop_gesture; Atom prop_gesture_param; Atom prop_hover; @@ -209,6 +210,9 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) values[0] = common->wcmTouch; prop_touch = InitWcmAtom(pInfo->dev, WACOM_PROP_TOUCH, XA_INTEGER, 8, 1, values); + values[0] = common->wcmMT; + prop_mt = InitWcmAtom(pInfo->dev, WACOM_PROP_ENABLE_MT, XA_INTEGER, 8, 1, values); + if (IsStylus(priv)) { values[0] = !common->wcmTPCButton; prop_hover = InitWcmAtom(pInfo->dev, WACOM_PROP_HOVER, XA_INTEGER, 8, 1, values); @@ -779,6 +783,18 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, if (!checkonly && common->wcmTouch != values[0]) common->wcmTouch = values[0]; + } else if (property == prop_mt) + { + CARD8 *values = (CARD8*)prop->data; + + if (prop->size != 1 || prop->format != 8) + return BadValue; + + if ((values[0] != 0) && (values[0] != 1)) + return BadValue; + + if (!checkonly && common->wcmMT != values[0]) + common->wcmMT = values[0]; } else if (property == prop_gesture) { CARD8 *values = (CARD8*)prop->data; diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index 2f3f7b4..15e9df5 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -1,6 +1,6 @@ /* * Copyright 1995-2002 by Frederic Lepied, France. <lep...@xfree86.org> - * Copyright 2002-2010 by Ping Cheng, Wacom. <pi...@wacom.com> + * Copyright 2002-2012 by Ping Cheng, Wacom. <pi...@wacom.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -455,6 +455,7 @@ struct _WacomCommonRec int wcmRotate; /* rotate screen (for TabletPC) */ int wcmThreshold; /* Threshold for button pressure */ WacomChannel wcmChannel[MAX_CHANNELS]; /* channel device state */ + BOOL wcmMT; /* only ST will be send when it is false */ WacomDeviceClassPtr wcmDevCls; /* device class functions */ WacomModelPtr wcmModel; /* model-specific functions */ diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index 9ab285b..3af2672 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -214,6 +214,16 @@ static param_t parameters[] = .prop_flags = PROP_FLAG_BOOLEAN }, { + .name = "MT", + .desc = "Turns on/off multi-touch events " + "(default is on). ", + .prop_name = WACOM_PROP_ENABLE_MT, + .prop_format = 8, + .prop_offset = 0, + .arg_count = 1, + .prop_flags = PROP_FLAG_BOOLEAN + }, + { .name = "ZoomDistance", .desc = "Minimum distance for a zoom gesture " "(default is 50). ", -- 1.7.6.4 ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel