summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPing Cheng <pingc@wacom.com>2013-06-07 15:34:03 -0700
committerPing Cheng <pingc@wacom.com>2013-06-07 15:34:03 -0700
commitbfb56bf858e08d95156d52cec9744d3d3251b59c (patch)
tree3c33fa3f5c8fe585b5448f3a91baf769c058da5b
parentf38dd5736e2df7c3eec0338bd0c7bef8c562b979 (diff)
downloadxf86-input-wacom-bfb56bf858e08d95156d52cec9744d3d3251b59c.tar.gz
Transform touch events just like all other events
Transform touch coordinates in the same way as other events coming from the wacom driver otherwise setting for exmaple the Wacom Rotation property has no effect Signed-off-by: Sjoerd Simons <sjoerd@greynoise.nl> Acked-by: Jason Gerecke <killertofu@gmail.com> Signed-off-by: Ping Cheng <pingc@wacom.com>
-rw-r--r--src/wcmTouchFilter.c69
1 files changed, 26 insertions, 43 deletions
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 07603af..bfd19de 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -101,58 +101,41 @@ static void getStateHistory(WacomCommonPtr common, WacomDeviceState states[], in
* the multitouch API available in XI2.2.
*
* @param[in] priv
- * @param[in] channel Channel to send a touch event for
+ * @param[in] contact_id ID of the contact to send event for
*/
static void
-wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel)
+wcmSendTouchEvent(WacomDevicePtr priv, int contact_id)
{
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
- ValuatorMask *mask = priv->common->touch_mask;
- WacomDeviceState state = channel->valid.state;
- WacomDeviceState oldstate = channel->valid.states[1];
- int type = -1;
+ WacomChannelPtr channel = getContactNumber(priv->common, contact_id);
- valuator_mask_set(mask, 0, state.x);
- valuator_mask_set(mask, 1, state.y);
+ if (channel) {
+ WacomDeviceState state = channel->valid.state;
+ ValuatorMask *mask = priv->common->touch_mask;
+ WacomDeviceState oldstate = channel->valid.states[1];
+ int type = -1;
- 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;
- }
+ wcmRotateAndScaleCoordinates (priv->pInfo, &state.x, &state.y);
- xf86PostTouchEvent(priv->pInfo->dev, state.serial_num - 1, type, 0, mask);
-#endif
-}
+ valuator_mask_set(mask, 0, state.x);
+ valuator_mask_set(mask, 1, state.y);
-/**
- * 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;
-
- 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 (!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;
}
+
+ xf86PostTouchEvent(priv->pInfo->dev, contact_id, type, 0, mask);
}
+#endif
}
static double touchDistance(WacomDeviceState ds0, WacomDeviceState ds1)
@@ -354,7 +337,7 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
/* Send multitouch data to X if appropriate */
if (!common->wcmGesture)
{
- wcmFingerMultitouch(priv, touch_id);
+ wcmSendTouchEvent(priv, touch_id);
return;
}
#endif