From: ping Cheng <pi...@wacom.com>

We do not allow finger competes with CURSOR.

Signed-off-by: Ping Cheng <pi...@wacom.com>
---
 src/wcmCommon.c     |   12 ++++++------
 src/wcmConfig.c     |   10 +++++-----
 src/wcmUSB.c        |   21 +++++++++++----------
 src/xf86WacomDefs.h |    1 +
 4 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 0dc6bab..5c4c95b 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1178,11 +1178,11 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
 
        if (TabletHasFeature(common, WCM_PENTOUCH))
        {
-               if (IsPen(priv))
+               if (IsTablet(priv))
                {
-                       /* send touch out when pen coming in-prox for devices
-                        * that provideboth pen and touch events so system
-                        * cursor won't jump between tools.
+                       /* send touch out when tablet tool coming in-prox for
+                        * devices that provide both pen/puck and touch events
+                        * so system cursor won't jump between tools.
                         */
                        if (common->wcmTouchDevice->oldProximity)
                        {
@@ -1192,11 +1192,11 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
                        }
                }
                else if (IsTouch(priv) && common->wcmPenInProx)
-                       /* Ignore touch events when pen is in prox */
+                       /* Ignore touch events when tablet tool is in prox */
                        return;
        }
 
-       if (IsPen(priv))
+       if (IsTablet(priv))
                common->wcmTouchDevice->common->wcmPenInProx = 
filtered.proximity;
 
        if ((IsPen(priv) || IsTouch(priv)) && common->wcmMaxZ)
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 87200eb..1c9eae7 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -414,9 +414,9 @@ static void wcmLinkTouchAndPen(InputInfoPtr pInfo)
 
                        if (tmpcommon->tablet_id == common->tablet_id)
                        {
-                               if (IsTouch(tmppriv) && IsPen(priv))
+                               if (IsTouch(tmppriv) && IsTablet(priv))
                                        common->wcmTouchDevice = tmppriv;
-                               else if (IsTouch(priv) && IsPen(tmppriv))
+                               else if (IsTouch(priv) && IsTablet(tmppriv))
                                        tmpcommon->wcmTouchDevice = priv;
 
                                if (common->wcmTouchDevice ||
@@ -575,10 +575,10 @@ static int wcmPreInit(InputDriverPtr drv, InputInfoPtr 
pInfo, int flags)
                pInfo->fd = -1;
        }
 
-       /* only link them once per port. We need to try for both pen and touch
-        * since we do not know which tool (touch or pen) will be added first.
+       /* only link them once per port. We need to try for both tablet tool
+        * and touch since we do not know which tool will be added first.
         */
-       if (IsTouch(priv) || (IsPen(priv) && !common->wcmTouchDevice))
+       if (IsTouch(priv) || (IsTablet(priv) && !common->wcmTouchDevice))
                wcmLinkTouchAndPen(pInfo);
 
        return Success;
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 62a6d83..75caa6b 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1552,18 +1552,19 @@ static int usbInitToolType(WacomCommonPtr common, const 
struct input_event *even
 }
 
 /**
- * Check if the tool is a stylus/eraser and in-prox or not.
+ * Check if the tool is a stylus/eraser/cursor and in-prox or not.
  *
  * @param device_type The tool type stored in wcmChannel
  * @param proximity The tool's proximity state
 
- * @return True if stylus/eraser is in-prox; False otherwise.
+ * @return True if stylus/eraser/cursor is in-prox; False otherwise.
  */
-static Bool usbIsPenInProx(int device_type, int proximity)
+static Bool usbIsTabletToolInProx(int device_type, int proximity)
 {
-       Bool is_pen = (device_type == STYLUS_ID) ||
-                       (device_type == ERASER_ID);
-       return (is_pen && proximity);
+       Bool is_tablet_tool = (device_type == STYLUS_ID) ||
+                               (device_type == CURSOR_ID) ||
+                               (device_type == ERASER_ID);
+       return (is_tablet_tool && proximity);
 }
 
 static void usbDispatchEvents(InputInfoPtr pInfo)
@@ -1586,15 +1587,15 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
 
        if (private->wcmPenTouch)
        {
-               /* We get both pen and touch data from the kernel when they
-                * both are in/down. So, if we were (hence the need of dslast)
-                * processing pen events, we should ignore touch events.
+               /* We get both tablet tool and touch data from the kernel when
+                * both tools are in/down. So, if we were (hence the need of 
dslast)
+                * processing tablet tool events, we should ignore touch events.
                 *
                 * MT events will be posted to the userland when XInput 2.1
                 * is ready.
                 */
                if ((private->wcmDeviceType == TOUCH_ID) &&
-                               usbIsPenInProx(dslast.device_type, 
dslast.proximity))
+                               usbIsTabletToolInProx(dslast.device_type, 
dslast.proximity))
                {
                        private->wcmEventCnt = 0;
                        return;
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 5b54de6..fe078ec 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -184,6 +184,7 @@ struct _WacomModel
 #define IsEraser(priv) (DEVICE_ID((priv)->flags) == ERASER_ID)
 #define IsPad(priv)    (DEVICE_ID((priv)->flags) == PAD_ID)
 #define IsPen(priv)    (IsStylus(priv) || IsEraser(priv))
+#define IsTablet(priv) (IsPen(priv) || IsCursor(priv))
 
 #define IsUSBDevice(common) ((common)->wcmDevCls == &gWacomUSBDevice)
 
-- 
1.7.10.4


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to