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.
---
 src/wcmUSB.c        |    3 +++
 src/xf86Wacom.c     |    6 +++++-
 src/xf86WacomDefs.h |    1 +
 3 files changed, 9 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/xf86Wacom.c b/src/xf86Wacom.c
index bb11cf4..808f5f8 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,10 @@ static int wcmDevInit(DeviceIntPtr pWcm)
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
        if (IsTouch(priv)) {
-               if (!InitTouchClassDeviceStruct(pInfo->dev, 0, 
XIDependentTouch, 2)) {
+               if (!common->wcmMaxContacts)
+                       common->wcmMaxContacts = 1;
+
+               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


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to