From: Chris Bagwell <[email protected]> Moved 4 different places were the touchscreen button press was done to a single location.
This also allows NOT sending 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. There are additional fixes needed to fully prevent unwanted button sends. This is just the start. Signed-off-by: Chris Bagwell <[email protected]> --- src/wcmISDV4.c | 2 +- src/wcmTouchFilter.c | 29 +++++++++++++++++++++++++++++ src/wcmUSB.c | 12 ------------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c index 82c709d..623c622 100644 --- a/src/wcmISDV4.c +++ b/src/wcmISDV4.c @@ -660,7 +660,7 @@ static int isdv4Parse(InputInfoPtr pInfo, const unsigned char* data, int len) 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 f02b712..9e0ee21 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -193,6 +193,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) { @@ -313,7 +339,10 @@ ret: * to detect second touch. */ if (common->wcmGesture && !channel && !common->wcmGestureMode) + { wcmSingleFingerTap(priv); + wcmSingleFingerPress(priv); + } } static void wcmSendScrollEvent(WacomDevicePtr priv, int dist, 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.5.4 ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
