Skip to content

Commit

Permalink
filter: make the trackpoint accel profile func the same prototype as …
Browse files Browse the repository at this point in the history
…the others

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Jul 11, 2018
1 parent 831ce3c commit 6dca5df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
5 changes: 3 additions & 2 deletions src/filter-trackpoint.c
Expand Up @@ -46,7 +46,8 @@ struct trackpoint_accelerator {
double
trackpoint_accel_profile(struct motion_filter *filter,
void *data,
double velocity)
double velocity,
uint64_t time)
{
struct trackpoint_accelerator *accel_filter =
(struct trackpoint_accelerator *)filter;
Expand Down Expand Up @@ -82,7 +83,7 @@ trackpoint_accelerator_filter(struct motion_filter *filter,
trackers_feed(&accel_filter->trackers, unaccelerated, time);
velocity = trackers_velocity(&accel_filter->trackers, time);

f = trackpoint_accel_profile(filter, data, velocity);
f = trackpoint_accel_profile(filter, data, velocity, time);
coords.x = unaccelerated->x * f;
coords.y = unaccelerated->y * f;

Expand Down
3 changes: 2 additions & 1 deletion src/filter.h
Expand Up @@ -154,5 +154,6 @@ touchpad_lenovo_x230_accel_profile(struct motion_filter *filter,
double
trackpoint_accel_profile(struct motion_filter *filter,
void *data,
double delta);
double delta,
uint64_t time);
#endif /* FILTER_H */
25 changes: 2 additions & 23 deletions tools/ptraccel-debug.c
Expand Up @@ -169,24 +169,6 @@ print_accel_func(struct motion_filter *filter,
}
}

static void
print_accel_func_trackpoint(struct motion_filter *filter,
int max)
{
printf("# gnuplot:\n");
printf("# set xlabel \"deltas (units)\"\n");
printf("# set ylabel \"raw accel factor\"\n");
printf("# set style data lines\n");
printf("# plot \"gnuplot.data\" using 1:2 title 'accel factor'\n");
printf("#\n");
printf("# data: delta(units) factor\n");
for (double delta = 0; delta < max; delta += 0.2) {
double factor = trackpoint_accel_profile(filter, NULL, delta);

printf("%.2f %f\n", delta, factor);
}
}

static void
usage(void)
{
Expand Down Expand Up @@ -350,7 +332,7 @@ main(int argc, char **argv)
profile = touchpad_lenovo_x230_accel_profile;
} else if (streq(filter_type, "trackpoint")) {
filter = create_pointer_accelerator_filter_trackpoint(tp_range_max);
profile = NULL; /* trackpoint is special */
profile = trackpoint_accel_profile;
} else {
fprintf(stderr, "Invalid filter type %s\n", filter_type);
return 1;
Expand Down Expand Up @@ -381,10 +363,7 @@ main(int argc, char **argv)

switch (mode) {
case ACCEL:
if (!profile) /* trackpoint */
print_accel_func_trackpoint(filter, tp_range_max);
else
print_accel_func(filter, profile, dpi);
print_accel_func(filter, profile, dpi);
break;
case DELTA:
print_ptraccel_deltas(filter, step);
Expand Down

0 comments on commit 6dca5df

Please sign in to comment.