This reverts commit f38dd5736e2df7c3eec0338bd0c7bef8c562b979.
---
src/wcmCommon.c | 8 +------
src/wcmTouchFilter.c | 59 ++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 7ffab2a..943f34d 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -995,14 +995,8 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
}
if ((ds.device_type == TOUCH_ID) && common->wcmTouch)
- {
wcmGestureFilter(priv, ds.serial_num - 1);
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
- /* When using XI 1.2 multitouch events don't do common
dispatching */
- if (!common->wcmGesture)
- return;
-#endif
- }
+
/* For touch, only first finger moves the cursor */
if ((common->wcmTouch && ds.device_type == TOUCH_ID && ds.serial_num ==
1) ||
(ds.device_type != TOUCH_ID))
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 8a761c6..3310560 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -38,6 +38,7 @@
#define GESTURE_PREDRAG_MODE 16
#define GESTURE_DRAG_MODE 32
#define GESTURE_CANCEL_MODE 64
+#define GESTURE_MULTITOUCH_MODE 128
#define WCM_SCROLL_UP 5 /* vertical up */
#define WCM_SCROLL_DOWN 4 /* vertical down */
@@ -103,9 +104,12 @@ 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)
+wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel, Bool no_update)
{
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
ValuatorMask *mask = priv->common->touch_mask;
@@ -122,7 +126,7 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr
channel)
DBG(6, priv->common, "This is a touch end event\n");
type = XI_TouchEnd;
}
- else if (!oldstate.proximity) {
+ else if (!oldstate.proximity || no_update) {
DBG(6, priv->common, "This is a touch begin event\n");
type = XI_TouchBegin;
}
@@ -136,26 +140,45 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr
channel)
}
/**
- * Send multitouch data to X server when ABI_XINPUT_VERSION >= 16 and
- * in driver gesture is not enabled.
+ * 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.
*
* @param[in] priv
- * @param[in] contact_id ID of the contact to send event for
+ * @param[in] contact_id ID of the contact to send event for (at minimum)
*/
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 (state.serial_num == contact_id + 1) {
- wcmSendTouchEvent(priv, channel);
+ if (lag_mode || state.serial_num == contact_id + 1) {
+ wcmSendTouchEvent(priv, channel, lag_mode);
}
+
+ 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)
@@ -371,15 +394,6 @@ 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);
@@ -404,6 +418,9 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
common->wcmGestureMode = GESTURE_NONE_MODE;
}
+ 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
@@ -536,6 +553,16 @@ 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)
{
--
2.1.0
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel