summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-09 13:22:53 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-14 08:46:28 +1000
commit5bf7018783d1a96c9fac7a9074274e9b8606604d (patch)
treed27714ac823b281758f5bbce1baf81c698abd274 /src
parent893ac427d0a7952c0f949071296fc2255790465e (diff)
Use arrays for st->mt scaling
No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/eventcomm.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 8904851..75040be 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -65,10 +65,8 @@ struct eventcomm_proto_data
* exists for readability of the code.
*/
BOOL need_grab;
- int st_to_mt_offset_x;
- double st_to_mt_scale_x;
- int st_to_mt_offset_y;
- double st_to_mt_scale_y;
+ int st_to_mt_offset[2];
+ double st_to_mt_scale[2];
#ifdef HAVE_MULTITOUCH
struct mtdev *mtdev;
int axis_map[MT_ABS_SIZE];
@@ -86,8 +84,8 @@ EventProtoDataAlloc(void)
if (!proto_data)
return NULL;
- proto_data->st_to_mt_scale_x = 1;
- proto_data->st_to_mt_scale_y = 1;
+ proto_data->st_to_mt_scale[0] = 1;
+ proto_data->st_to_mt_scale[1] = 1;
return proto_data;
}
@@ -424,11 +422,11 @@ event_query_axis_ranges(InputInfoPtr pInfo)
event_get_abs(pInfo, pInfo->fd, ABS_MT_POSITION_Y, &priv->miny,
&priv->maxy, &priv->synpara.hyst_y, &priv->resy);
- proto_data->st_to_mt_offset_x = priv->minx - st_minx;
- proto_data->st_to_mt_scale_x =
+ proto_data->st_to_mt_offset[0] = priv->minx - st_minx;
+ proto_data->st_to_mt_scale[0] =
(priv->maxx - priv->minx) / (st_maxx - st_minx);
- proto_data->st_to_mt_offset_y = priv->miny - st_miny;
- proto_data->st_to_mt_scale_y =
+ proto_data->st_to_mt_offset[1] = priv->miny - st_miny;
+ proto_data->st_to_mt_scale[1] =
(priv->maxy - priv->miny) / (st_maxy - st_miny);
}
#endif
@@ -682,12 +680,12 @@ EventReadHwState(InputInfoPtr pInfo,
if (ev.code < ABS_MT_SLOT) {
switch (ev.code) {
case ABS_X:
- hw->x = ev.value * proto_data->st_to_mt_scale_x +
- proto_data->st_to_mt_offset_x;
+ hw->x = ev.value * proto_data->st_to_mt_scale[0] +
+ proto_data->st_to_mt_offset[0];
break;
case ABS_Y:
- hw->y = ev.value * proto_data->st_to_mt_scale_y +
- proto_data->st_to_mt_offset_y;
+ hw->y = ev.value * proto_data->st_to_mt_scale[1] +
+ proto_data->st_to_mt_offset[1];
break;
case ABS_PRESSURE:
hw->z = ev.value;