On Wed, Aug 05, 2015 at 04:32:43PM +1000, Peter Hutterer wrote: > Signed-off-by: Peter Hutterer <[email protected]>
Reviewed-by: Jonas Ådahl <[email protected]> > --- > tools/ptraccel-debug.c | 43 ++++++++++++++++++++++++++++++++++++------- > 1 file changed, 36 insertions(+), 7 deletions(-) > > diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c > index 077da59..aa887fe 100644 > --- a/tools/ptraccel-debug.c > +++ b/tools/ptraccel-debug.c > @@ -138,7 +138,7 @@ print_ptraccel_sequence(struct motion_filter *filter, > } > > static void > -print_accel_func(struct motion_filter *filter) > +print_accel_func(struct motion_filter *filter, accel_profile_func_t profile) > { > double vel; > > @@ -148,10 +148,7 @@ print_accel_func(struct motion_filter *filter) > printf("# set style data lines\n"); > printf("# plot \"gnuplot.data\" using 1:2\n"); > for (vel = 0.0; vel < 0.003; vel += 0.0000001) { > - double result = pointer_accel_profile_linear(filter, > - NULL, > - vel, > - 0 /* time */); > + double result = profile(filter, NULL, vel, 0 /* time */); > printf("%.8f\t%.4f\n", vel, result); > } > } > @@ -171,6 +168,12 @@ usage(void) > "--steps=<double> ... in motion and delta modes only. Increase > dx by step each round\n" > "--speed=<double> ... accel speed [-1, 1], default 0\n" > "--dpi=<int> ... device resolution in DPI (default: 1000)\n" > + "--filter=<linear|low-dpi|touchpad|x230|trackpoint> \n" > + " linear ... the default motion filter\n" > + " low-dpi ... low-dpi filter, use --dpi with this > argument\n" > + " touchpad ... the touchpad motion filter\n" > + " x230 ... custom filter for the Lenovo x230 > touchpad\n" > + " trackpoint... trackpoint motion filter\n" > "\n" > "If extra arguments are present and mode is not given, mode > defaults to 'sequence'\n" > "and the arguments are interpreted as sequence of delta x > coordinates\n" > @@ -195,6 +198,8 @@ main(int argc, char **argv) > double custom_deltas[1024]; > double speed = 0.0; > int dpi = 1000; > + const char *filter_type = "linear"; > + accel_profile_func_t profile = NULL; > > enum { > OPT_MODE = 1, > @@ -203,6 +208,7 @@ main(int argc, char **argv) > OPT_STEP, > OPT_SPEED, > OPT_DPI, > + OPT_FILTER, > }; > > while (1) { > @@ -215,6 +221,7 @@ main(int argc, char **argv) > {"step", 1, 0, OPT_STEP }, > {"speed", 1, 0, OPT_SPEED }, > {"dpi", 1, 0, OPT_DPI }, > + {"filter", 1, 0, OPT_FILTER}, > {0, 0, 0, 0} > }; > > @@ -265,6 +272,9 @@ main(int argc, char **argv) > case OPT_DPI: > dpi = strtod(optarg, NULL); > break; > + case OPT_FILTER: > + filter_type = optarg; > + break; > default: > usage(); > exit(1); > @@ -272,7 +282,26 @@ main(int argc, char **argv) > } > } > > - filter = create_pointer_accelerator_filter_linear(dpi); > + if (streq(filter_type, "linear")) { > + filter = create_pointer_accelerator_filter_linear(dpi); > + profile = pointer_accel_profile_linear; > + } else if (streq(filter_type, "low-dpi")) { > + filter = create_pointer_accelerator_filter_linear_low_dpi(dpi); > + profile = pointer_accel_profile_linear_low_dpi; > + } else if (streq(filter_type, "touchpad")) { > + filter = create_pointer_accelerator_filter_touchpad(dpi); > + profile = touchpad_accel_profile_linear; > + } else if (streq(filter_type, "x230")) { > + filter = create_pointer_accelerator_filter_lenovo_x230(dpi); > + profile = touchpad_lenovo_x230_accel_profile; > + } else if (streq(filter_type, "trackpoint")) { > + filter = create_pointer_accelerator_filter_trackpoint(dpi); > + profile = trackpoint_accel_profile; > + } else { > + fprintf(stderr, "Invalid filter type %s\n", filter_type); > + return 1; > + } > + > assert(filter != NULL); > filter_set_speed(filter, speed); > > @@ -296,7 +325,7 @@ main(int argc, char **argv) > } > > if (print_accel) > - print_accel_func(filter); > + print_accel_func(filter, profile); > else if (print_delta) > print_ptraccel_deltas(filter, step); > else if (print_motion) > -- > 2.4.3 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
