Clients should know the maximum number of contacts a touch device
support before they get touch events.

Signed-off-by: Ping Cheng <pi...@wacom.com>

---
The following TO-DO takes more time than I have now. I list it
here so we do not forget them.

X server supports pointer emulation for touch device. We should
let X server take care of single touch events for both MT and
single touch devices that are running on newer servers;

Touch events are currently all posted in relative mode (touchpad).
We need to support absolute mode (touchscreen) devices.

With MT enabled in XInput, we can post pen and touch events
simultaneously now. MAX_CHANNELS and WacomChannel array need to
be reconsided to facilitate this support.
---
 src/wcmUSB.c            |    3 +++
 src/wcmValidateDevice.c |    5 +++++
 src/xf86Wacom.c         |    3 ++-
 src/xf86WacomDefs.h     |    1 +
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 5cc7830..acce5ee 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -681,6 +681,9 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
        {
                private->wcmUseMT = 1;
 
+               if (!ioctl(pInfo->fd, EVIOCGABS(ABS_MT_SLOT), &absinfo))
+                       common->wcmMaxContacts = absinfo.maximum + 1;
+
                /* pen and MT on the same logical port */
                if (ISBITSET(common->wcmKeys, BTN_TOOL_PEN))
                        private->wcmPenTouch = TRUE;
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 3571a34..959ee26 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -896,6 +896,11 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool 
is_primary,
                else if (touch_is_on != common->wcmTouch)
                        xf86Msg(X_WARNING, "%s: Touch option can only be set "
                                "by a touch tool.\n", pInfo->name);
+
+               if (TabletHasFeature(common, WCM_1FGT))
+                       common->wcmMaxContacts = 1;
+               else
+                       common->wcmMaxContacts = 2;
        }
 
        /* 2FG touch device */
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index bb11cf4..4d38bb3 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -323,6 +323,7 @@ static int wcmDevInit(DeviceIntPtr pWcm)
 {
        InputInfoPtr pInfo = (InputInfoPtr)pWcm->public.devicePrivate;
        WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
+       WacomCommonPtr common = priv->common;
        unsigned char butmap[WCM_MAX_BUTTONS+1];
        int nbaxes, nbbuttons, nbkeys;
        int loop;
@@ -421,7 +422,7 @@ static int wcmDevInit(DeviceIntPtr pWcm)
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
        if (IsTouch(priv)) {
-               if (!InitTouchClassDeviceStruct(pInfo->dev, 0, 
XIDependentTouch, 2)) {
+               if (!InitTouchClassDeviceStruct(pInfo->dev, 
common->wcmMaxContacts, XIDependentTouch, 2)) {
                        xf86Msg(X_ERROR, "Unable to init touch class device 
struct!\n");
                        return FALSE;
                }
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 7df0e95..abfde70 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -446,6 +446,7 @@ struct _WacomCommonRec
                                     /* tablet Z resolution is equivalent
                                      * to wcmMaxZ which is equal to 100% 
pressure */
        int wcmMaxDist;              /* tablet max distance value */
+       int wcmMaxContacts;          /* MT device max number of contacts */
 
        /*
         * TODO Remove wcmTiltOff*, once the kernel drivers reporting
-- 
1.7.10.4


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to