diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-09 13:25:27 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-14 08:46:31 +1000 |
commit | 4eea50d513bca888d8fe13759d0cc44de67bc4c0 (patch) | |
tree | e599685108e0999399f7625dbf1adc7a3433b51c | |
parent | 5bf7018783d1a96c9fac7a9074274e9b8606604d (diff) |
Move st->mt scaling to helper function
No functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | src/eventcomm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 75040be..b49b73a 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -595,6 +595,12 @@ static int count_fingers(const struct CommData *comm) } +static inline double +apply_st_scaling(struct eventcomm_proto_data *proto_data, int value, int axis) +{ + return value * proto_data->st_to_mt_scale[axis] + proto_data->st_to_mt_offset[axis]; +} + Bool EventReadHwState(InputInfoPtr pInfo, struct CommData *comm, struct SynapticsHwState *hwRet) @@ -680,12 +686,10 @@ 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[0] + - proto_data->st_to_mt_offset[0]; + hw->x = apply_st_scaling(proto_data, ev.value, 0); break; case ABS_Y: - hw->y = ev.value * proto_data->st_to_mt_scale[1] + - proto_data->st_to_mt_offset[1]; + hw->y = apply_st_scaling(proto_data, ev.value, 1); break; case ABS_PRESSURE: hw->z = ev.value; |