To support arbitration, we only needed to access touch pointer
from pen interfaces. Now, we need to access touch pointer from
touch interfaces to update touch switch state.

Since other tools, such as PAD, can be associated with touch
interfaces, we can not assume the first tool created on touch
interface is a touch tool. Assign it to wcmTouchDevice to avoid
looping through the tool list everytime when we need to access it.

Signed-off-by: Ping Cheng <pi...@wacom.com>
---
 src/wcmConfig.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 103fc15..1d5442e 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -386,8 +386,10 @@ wcmInitModel(InputInfoPtr pInfo)
 }
 
 /**
- * Link the touch tool to the pen of the same device
- * so we can arbitrate the events when posting them.
+ * Lookup to find the associated pen and touch for the same device.
+ * Store touch tool in wcmTouchDevice for pen and touch, respectively,
+ * of the same device. Update TabletFeature to indicate it is a hybrid
+ * of touch and pen.
  *
  * @param allow_different_id TRUE to check different product IDs
  *
@@ -412,18 +414,25 @@ static Bool wcmLinkTouchAndPen(InputInfoPtr pInfo, Bool 
allow_different_id)
                tmpcommon = tmppriv->common;
 
                /* skip the same tool or already linked devices */
-               if ((tmppriv == priv) || tmpcommon->wcmTouchDevice)
+               if ((tmppriv == priv) || (tmpcommon->wcmTouchDevice && 
IsTablet(tmppriv)))
                        continue;
 
                if (((tmpcommon->tablet_id == common->tablet_id) && 
!allow_different_id) ||
                   ((tmpcommon->tablet_id == common->tablet_id) && 
allow_different_id))
                {
-                       if (IsTouch(tmppriv) && IsTablet(priv))
+                       if (IsTouch(tmppriv))
+                       {
                                common->wcmTouchDevice = tmppriv;
-                       else if (IsTouch(priv) && IsTablet(tmppriv))
+                               tmpcommon->wcmTouchDevice = tmppriv;
+                       }
+                       else if (IsTouch(priv))
+                       {
+                               common->wcmTouchDevice = priv;
                                tmpcommon->wcmTouchDevice = priv;
+                       }
 
-                       if (common->wcmTouchDevice || tmpcommon->wcmTouchDevice)
+                       if ((common->wcmTouchDevice && IsTablet(priv)) ||
+                           (tmpcommon->wcmTouchDevice && IsTablet(tmppriv)))
                        {
                                TabletSetFeature(common, WCM_PENTOUCH);
                                TabletSetFeature(tmpcommon, WCM_PENTOUCH);
-- 
1.8.3.2


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to