double touchpad_accel_profile_linear(struct motion_filter *filter, void *data, double speed_in, /* units/us */ uint64_t time) { double factor; /* unitless */ speed_in *= TP_MAGIC_SLOWDOWN; factor = pointer_accel_profile_linear(filter, data, speed_in, time); return factor * TP_MAGIC_SLOWDOWN; }
static void print_accel_func(struct motion_filter *filter) { double vel; printf("# gnuplot:\n"); printf("# set xlabel \"speed\"\n"); printf("# set ylabel \"raw accel factor\"\n"); printf("# set style data lines\n"); printf("# plot \"gnuplot.data\" using 1:2\n"); for (vel = 0.0; vel < 3.0; vel += .0001) { double result = pointer_accel_profile_linear(filter, NULL, vel, 0 /* time */); printf("%.4f\t%.4f\n", vel, result); } }
double touchpad_accel_profile_linear(struct motion_filter *filter, void *data, double speed_in, uint64_t time) { /* Once normalized, touchpads see the same acceleration as mice. that is technically correct but subjectively wrong, we expect a touchpad to be a lot slower than a mouse. Apply a magic factor here and proceed as normal. */ const double TP_MAGIC_SLOWDOWN = 0.4; double speed_out; speed_in *= TP_MAGIC_SLOWDOWN; speed_out = pointer_accel_profile_linear(filter, data, speed_in, time); return speed_out * TP_MAGIC_SLOWDOWN; }