Code that deals with touch points shouldn't care which channel an
event is occuring in; it should be more concerned with the finger
that caused it. At the moment these are the same things (first
finger is always in channel zero), but this will soon change.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmCommon.c      | 4 ++--
 src/wcmISDV4.c       | 7 ++++++-
 src/wcmTouchFilter.c | 8 ++++----
 src/wcmTouchFilter.h | 2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index cb76d5a..fb6fc8b 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -970,10 +970,10 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
        if (pChannel->nSamples < common->wcmRawSample) ++pChannel->nSamples;
 
        if ((ds.device_type == TOUCH_ID) && common->wcmTouch)
-               wcmGestureFilter(priv, channel);
+               wcmGestureFilter(priv, ds.serial_num - 1);
 
        /* For touch, only first finger moves the cursor */
-       if ((ds.device_type == TOUCH_ID && common->wcmTouch && !channel) ||
+       if ((common->wcmTouch && ds.device_type == TOUCH_ID && ds.serial_num == 
1) ||
            (ds.device_type != TOUCH_ID))
                commonDispatchDevice(common,channel,pChannel, suppress);
 }
diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 2528254..f0e0bc7 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -625,6 +625,7 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const 
unsigned char *data,
        ds->proximity = touchdata.status;
        ds->device_type = TOUCH_ID;
        ds->device_id = TOUCH_DEVICE_ID;
+       ds->serial_num = 1;
 
        if (common->wcmPktLength == ISDV4_PKGLEN_TOUCH2FG)
        {
@@ -648,6 +649,7 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const 
unsigned char *data,
                        ds->y = touchdata.finger2.y;
                        ds->device_type = TOUCH_ID;
                        ds->device_id = TOUCH_DEVICE_ID;
+                       ds->serial_num = 2;
                        ds->proximity = touchdata.finger2.status;
                        /* time stamp for 2FGT gesture events */
                        if ((ds->proximity && !lastTemp->proximity) ||
@@ -791,6 +793,7 @@ static int isdv4Parse(InputInfoPtr pInfo, const unsigned 
char* data, int len)
                        /* let touch go */
                        WacomDeviceState out = { 0 };
                        out.device_type = TOUCH_ID;
+                       out.serial_num = 1;
                        wcmEvent(common, channel, &out);
                }
        }
@@ -807,8 +810,10 @@ static int isdv4Parse(InputInfoPtr pInfo, const unsigned 
char* data, int len)
 
        if (common->wcmPktLength == ISDV4_PKGLEN_TPCPEN)
                channel = isdv4ParsePenPacket(pInfo, data, len, ds);
-       else /* a touch */
+       else { /* a touch */
                channel = isdv4ParseTouchPacket(pInfo, data, len, ds);
+               ds = &common->wcmChannel[channel].work;
+       }
 
        if (channel < 0)
                return 0;
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index bf0ecec..85de532 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -233,7 +233,7 @@ static void wcmSingleFingerPress(WacomDevicePtr priv)
 }
 
 /* parsing gesture mode according to 2FGT data */
-void wcmGestureFilter(WacomDevicePtr priv, int channel)
+void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
 {
        WacomCommonPtr common = priv->common;
        WacomChannelPtr firstChannel = common->wcmChannel;
@@ -316,7 +316,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
                common->wcmGestureParameters.wcmGestureUsed  = 0;
 
                /* initialize the cursor position */
-               if (common->wcmGestureMode == GESTURE_NONE_MODE && !channel)
+               if (common->wcmGestureMode == GESTURE_NONE_MODE && touch_id == 
0)
                        goto ret;
 
                /* got second touch in TapTime interval after first one,
@@ -349,7 +349,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
                goto ret;
        }
 
-       if (!(common->wcmGestureMode & (GESTURE_SCROLL_MODE | 
GESTURE_ZOOM_MODE)) && channel)
+       if (!(common->wcmGestureMode & (GESTURE_SCROLL_MODE | 
GESTURE_ZOOM_MODE)) && touch_id == 1)
                wcmFingerTapToClick(priv);
 
        /* Change mode happens only when both fingers are out */
@@ -387,7 +387,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int channel)
                }
        }
 ret:
-       if (common->wcmGestureMode == GESTURE_NONE_MODE && !channel)
+       if (common->wcmGestureMode == GESTURE_NONE_MODE && touch_id == 0)
        {
                /* Since this is in ret block, can not rely on generic
                 * wcmGesture enable check from above.
diff --git a/src/wcmTouchFilter.h b/src/wcmTouchFilter.h
index 331abde..fc55748 100644
--- a/src/wcmTouchFilter.h
+++ b/src/wcmTouchFilter.h
@@ -24,7 +24,7 @@
 
 /****************************************************************************/
 
-void wcmGestureFilter(WacomDevicePtr priv, int channel);
+void wcmGestureFilter(WacomDevicePtr priv, int touch_id);
 Bool wcmTouchNeedSendEvents(WacomCommonPtr common);
 
 /****************************************************************************/
-- 
1.7.12


------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to