From 8e5b56e7a461c416d5b29f338bbd749626452b5d Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Wed, 10 Jul 2013 13:50:55 -0700 Subject: Revert "Transform touch events just like all other events" This reverts commit bfb56bf858e08d95156d52cec9744d3d3251b59c. This commit will be split in two to provide proper credit for each of the two authors. Signed-off-by: Jason Gerecke --- src/wcmTouchFilter.c | 69 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index bfd19de..07603af 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -101,41 +101,58 @@ static void getStateHistory(WacomCommonPtr common, WacomDeviceState states[], in * the multitouch API available in XI2.2. * * @param[in] priv - * @param[in] contact_id ID of the contact to send event for + * @param[in] channel Channel to send a touch event for */ static void -wcmSendTouchEvent(WacomDevicePtr priv, int contact_id) +wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel) { #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16 - WacomChannelPtr channel = getContactNumber(priv->common, contact_id); + ValuatorMask *mask = priv->common->touch_mask; + WacomDeviceState state = channel->valid.state; + WacomDeviceState oldstate = channel->valid.states[1]; + int type = -1; - if (channel) { - WacomDeviceState state = channel->valid.state; - ValuatorMask *mask = priv->common->touch_mask; - WacomDeviceState oldstate = channel->valid.states[1]; - int type = -1; + valuator_mask_set(mask, 0, state.x); + valuator_mask_set(mask, 1, state.y); - wcmRotateAndScaleCoordinates (priv->pInfo, &state.x, &state.y); + if (!state.proximity) { + DBG(6, priv->common, "This is a touch end event\n"); + type = XI_TouchEnd; + } + else if (!oldstate.proximity) { + DBG(6, priv->common, "This is a touch begin event\n"); + type = XI_TouchBegin; + } + else { + DBG(6, priv->common, "This is a touch update event\n"); + type = XI_TouchUpdate; + } - valuator_mask_set(mask, 0, state.x); - valuator_mask_set(mask, 1, state.y); + xf86PostTouchEvent(priv->pInfo->dev, state.serial_num - 1, type, 0, mask); +#endif +} - if (!state.proximity) { - DBG(6, priv->common, "This is a touch end event\n"); - type = XI_TouchEnd; - } - else if (!oldstate.proximity) { - DBG(6, priv->common, "This is a touch begin event\n"); - type = XI_TouchBegin; - } - else { - DBG(6, priv->common, "This is a touch update event\n"); - type = XI_TouchUpdate; - } +/** + * 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 + */ +static void +wcmFingerMultitouch(WacomDevicePtr priv, int contact_id) { + int i; - xf86PostTouchEvent(priv->pInfo->dev, contact_id, type, 0, mask); + 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); + } } -#endif } static double touchDistance(WacomDeviceState ds0, WacomDeviceState ds1) @@ -337,7 +354,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id) /* Send multitouch data to X if appropriate */ if (!common->wcmGesture) { - wcmSendTouchEvent(priv, touch_id); + wcmFingerMultitouch(priv, touch_id); return; } #endif -- cgit v1.2.1