From: Chris Bagwell <ch...@cnpbagwell.com> Moved 4 different places were the touchscreen button press was done to a single location.
This allows to NOT send a button pressure while gesture detection is being performed. That unwanted button press could do some annoying things when trying to do a 2 finger scroll on a touchscreen. Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com> --- src/wcmISDV4.c | 2 +- src/wcmTouchFilter.c | 27 +++++++++++++++++++++++++++ src/wcmUSB.c | 12 ------------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c index dbc0c6a..5a123cd 100644 --- a/src/wcmISDV4.c +++ b/src/wcmISDV4.c @@ -612,7 +612,7 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const unsigned char *data, ds->x = touchdata.x; ds->y = touchdata.y; - ds->buttons = ds->proximity = touchdata.status; + ds->proximity = touchdata.status; ds->device_type = TOUCH_ID; ds->device_id = TOUCH_DEVICE_ID; diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index 91849f4..b788e34 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -194,6 +194,32 @@ static void wcmSingleFingerTap(WacomDevicePtr priv) } } +/* Monitors for 1 finger touch and forces left button press or 1 finger + * release and will remove left button press. + * + * This function relies on wcmGestureMode will only be zero if + * WACOM_GESTURE_LAG_TIME has passed and still ony 1 finger on screen. + */ +static void wcmSingleFingerPress(WacomDevicePtr priv) +{ + WacomCommonPtr common = priv->common; + WacomChannelPtr firstChannel = common->wcmChannel; + WacomChannelPtr secondChannel = common->wcmChannel + 1; + WacomDeviceState ds[2] = { firstChannel->valid.states[0], + secondChannel->valid.states[0] }; + + DBG(10, priv, "\n"); + + /* This gesture is only valid on touchscreens. */ + if (!TabletHasFeature(priv->common, WCM_LCD)) + return; + + if (ds[0].proximity && !ds[1].proximity) + firstChannel->valid.states[0].buttons |= 1; + if (!ds[0].proximity && !ds[1].proximity) + firstChannel->valid.states[0].buttons &= ~1; +} + /* parsing gesture mode according to 2FGT data */ void wcmGestureFilter(WacomDevicePtr priv, int channel) { @@ -340,6 +366,7 @@ ret: */ if (common->wcmGesture) wcmSingleFingerTap(priv); + wcmSingleFingerPress(priv); } } diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 4367f19..14de990 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1110,14 +1110,6 @@ static int usbParseAbsMTEvent(WacomCommonPtr common, struct input_event *event) ds->device_id = TOUCH_DEVICE_ID; ds->serial_num = private->wcmMTChannel+1; ds->sample = (int)GetTimeInMillis(); - - /* Send left click down/up for touchscreen - * when the first finger touches/leaves the tablet. - */ - if (TabletHasFeature(common, WCM_LCD) && - !private->wcmMTChannel) - ds->buttons = mod_buttons(ds->buttons, 0, - (event->value != -1)); break; case ABS_MT_POSITION_X: @@ -1223,7 +1215,6 @@ static int usbParseKeyEvent(WacomCommonPtr common, ds->device_type = TOUCH_ID; ds->device_id = TOUCH_DEVICE_ID; ds->proximity = event->value; - ds->buttons = mod_buttons(ds->buttons, 0, event->value); } } break; @@ -1253,9 +1244,6 @@ static int usbParseKeyEvent(WacomCommonPtr common, if ((ds->proximity && !dslast->proximity) || (!ds->proximity && dslast->proximity)) ds->sample = (int)GetTimeInMillis(); - /* left button is always pressed for touchscreen */ - if (TabletHasFeature(common, WCM_LCD)) - ds->buttons = mod_buttons(ds->buttons, 0, event->value); break; case BTN_TOOL_TRIPLETAP: -- 1.7.6 ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel