diff options
Diffstat (limited to 'src/wcmTouchFilter.c')
-rw-r--r-- | src/wcmTouchFilter.c | 61 |
1 files changed, 17 insertions, 44 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index 5e0d349..07603af 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -1,5 +1,5 @@ /* - * Copyright 2009 - 2010 by Ping Cheng, Wacom. <pingc@wacom.com> + * Copyright 2009 - 2013 by Ping Cheng, Wacom. <pingc@wacom.com> * Copyright 2011 by Alexey Osipov. <simba@lerlan.ru> * * This program is free software; you can redistribute it and/or @@ -37,7 +37,6 @@ #define GESTURE_LAG_MODE 8 #define GESTURE_PREDRAG_MODE 16 #define GESTURE_DRAG_MODE 32 -#define GESTURE_MULTITOUCH_MODE 64 #define WCM_SCROLL_UP 5 /* vertical up */ #define WCM_SCROLL_DOWN 4 /* vertical down */ @@ -103,12 +102,9 @@ static void getStateHistory(WacomCommonPtr common, WacomDeviceState states[], in * * @param[in] priv * @param[in] channel Channel to send a touch event for - * @param[in] no_update If 'true', TouchUpdate events will not be created. - * This should be used when entering multitouch mode to ensure TouchBegin - * events are sent for already-in-prox contacts. */ static void -wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel, Bool no_update) +wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel) { #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16 ValuatorMask *mask = priv->common->touch_mask; @@ -123,7 +119,7 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel, Bool no_update) DBG(6, priv->common, "This is a touch end event\n"); type = XI_TouchEnd; } - else if (!oldstate.proximity || no_update) { + else if (!oldstate.proximity) { DBG(6, priv->common, "This is a touch begin event\n"); type = XI_TouchBegin; } @@ -137,45 +133,26 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel, Bool no_update) } /** - * Send multitouch events. If entering multitouch mode (indicated by - * GESTURE_LAG_MODE), then touch events are sent for all in-prox - * contacts. Otherwise, only the specified contact has a touch event - * generated. + * Send multitouch data to X server when ABI_XINPUT_VERSION >= 16 and + * in driver gesture is not enabled. * * @param[in] priv - * @param[in] contact_id ID of the contact to send event for (at minimum) + * @param[in] contact_id ID of the contact to send event for */ static void wcmFingerMultitouch(WacomDevicePtr priv, int contact_id) { - Bool lag_mode = priv->common->wcmGestureMode == GESTURE_LAG_MODE; - Bool prox = FALSE; int i; - if (lag_mode && TabletHasFeature(priv->common, WCM_LCD)) { - /* wcmSingleFingerPress triggers a button press as - * soon as a single finger appears. ensure we release - * that button before getting too far along - */ - wcmSendButtonClick(priv, 1, 0); - } - for (i = 0; i < MAX_CHANNELS; i++) { WacomChannelPtr channel = priv->common->wcmChannel+i; WacomDeviceState state = channel->valid.state; if (state.device_type != TOUCH_ID) continue; - if (lag_mode || state.serial_num == contact_id + 1) { - wcmSendTouchEvent(priv, channel, lag_mode); + if (state.serial_num == contact_id + 1) { + wcmSendTouchEvent(priv, channel); } - - prox |= state.proximity; } - - if (!prox) - priv->common->wcmGestureMode = GESTURE_NONE_MODE; - else if (lag_mode) - priv->common->wcmGestureMode = GESTURE_MULTITOUCH_MODE; } static double touchDistance(WacomDeviceState ds0, WacomDeviceState ds1) @@ -373,6 +350,15 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) WacomCommonPtr common = priv->common; WacomDeviceState ds[2] = {{0}}, dsLast[2] = {{0}}; +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16 + /* Send multitouch data to X if appropriate */ + if (!common->wcmGesture) + { + wcmFingerMultitouch(priv, touch_id); + return; + } +#endif + getStateHistory(common, ds, ARRAY_SIZE(ds), 0); getStateHistory(common, dsLast, ARRAY_SIZE(dsLast), 1); @@ -386,9 +372,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) return; } - if (common->wcmGestureMode == GESTURE_MULTITOUCH_MODE) - goto ret; - /* When 2 fingers are in proximity, it must always be in one of * the valid 2 fingers modes: LAG, SCROLL, or ZOOM. * LAG mode is used while deciding between SCROLL and ZOOM and @@ -521,16 +504,6 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) } ret: -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16 - /* Send multitouch data to X if appropriate */ - if (!common->wcmGesture && ds[1].proximity && common->wcmGestureMode == GESTURE_NONE_MODE) - common->wcmGestureMode = GESTURE_LAG_MODE; - if (!common->wcmGesture && (common->wcmGestureMode == GESTURE_LAG_MODE || - common->wcmGestureMode == GESTURE_MULTITOUCH_MODE)) { - wcmFingerMultitouch(priv, touch_id); - } -#endif - if ((common->wcmGestureMode == GESTURE_NONE_MODE || common->wcmGestureMode == GESTURE_DRAG_MODE) && touch_id == 0) { |