summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-12-15 08:36:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-12-21 10:55:57 +1000
commitbdd4264d6150f4a6248eec7e1fbf74a2837ac77f (patch)
treed24ba97ab3442e20875d1f071666a22f17fa3589 /tools
parent187c38f660d6dd02cd361fafe554d14684a728ae (diff)
filter: change the filter functions to take raw device coordinates
We used to normalize all deltas to equivalents of a 1000dpi mouse before passing it into the acceleration functions. This has a bunch of drawbacks, not least that we already have to un-normalize back into device units for a few devices already (trackpoints, tablet, low-dpi mice). Switch the filter code over to use device units, relying on the dpi set earlier during filter creation to convert to normalized. To make things easy, the output of the filter code is still normalized data, i.e. data ready to be handed to the libinput caller. No effective functional changes. For touchpads, we still send normalized coordinates (for now, anyway). For the various filter methods, we either drop the places where we unnormalized before or we normalize where needed. Two possible changes: for trackpoints and low-dpi mice we had a max dpi factor of 1.0 before - now we don't anymore. This was only the case if a low-dpi mouse had more than 1000dpi (never true) or a trackpoint had a const accel lower than 1.0 (yeah, whatever). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/ptraccel-debug.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c
index 84a1221..4ecb7e8 100644
--- a/tools/ptraccel-debug.c
+++ b/tools/ptraccel-debug.c
@@ -38,7 +38,8 @@
static void
print_ptraccel_deltas(struct motion_filter *filter, double step)
{
- struct normalized_coords motion;
+ struct device_float_coords motion;
+ struct normalized_coords accel;
uint64_t time = 0;
double i;
@@ -55,9 +56,9 @@ print_ptraccel_deltas(struct motion_filter *filter, double step)
motion.y = 0;
time += us(12500); /* pretend 80Hz data */
- motion = filter_dispatch(filter, &motion, NULL, time);
+ accel = filter_dispatch(filter, &motion, NULL, time);
- printf("%.2f %.3f\n", i, motion.x);
+ printf("%.2f %.3f\n", i, accel.x);
}
}
@@ -67,7 +68,8 @@ print_ptraccel_movement(struct motion_filter *filter,
double max_dx,
double step)
{
- struct normalized_coords motion;
+ struct device_float_coords motion;
+ struct normalized_coords accel;
uint64_t time = 0;
double dx;
int i;
@@ -98,9 +100,9 @@ print_ptraccel_movement(struct motion_filter *filter,
motion.y = 0;
time += us(12500); /* pretend 80Hz data */
- motion = filter_dispatch(filter, &motion, NULL, time);
+ accel = filter_dispatch(filter, &motion, NULL, time);
- printf("%d %.3f %.3f\n", i, motion.x, dx);
+ printf("%d %.3f %.3f\n", i, accel.x, dx);
if (dx < max_dx)
dx += step;
@@ -112,7 +114,8 @@ print_ptraccel_sequence(struct motion_filter *filter,
int nevents,
double *deltas)
{
- struct normalized_coords motion;
+ struct device_float_coords motion;
+ struct normalized_coords accel;
uint64_t time = 0;
double *dx;
int i;
@@ -132,9 +135,9 @@ print_ptraccel_sequence(struct motion_filter *filter,
motion.y = 0;
time += us(12500); /* pretend 80Hz data */
- motion = filter_dispatch(filter, &motion, NULL, time);
+ accel = filter_dispatch(filter, &motion, NULL, time);
- printf("%d %.3f %.3f\n", i, motion.x, *dx);
+ printf("%d %.3f %.3f\n", i, accel.x, *dx);
}
}