tools: add --dpi= arg to ptraccel-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-06-19 16:19:27 +10:00
parent 40dab334ab
commit 4df1a9b66e

View file

@ -168,6 +168,7 @@ usage(void)
"--maxdx=<double> ... in motion mode only. Stop increasing dx at maxdx\n" "--maxdx=<double> ... in motion mode only. Stop increasing dx at maxdx\n"
"--steps=<double> ... in motion and delta modes only. Increase dx by step each round\n" "--steps=<double> ... in motion and delta modes only. Increase dx by step each round\n"
"--speed=<double> ... accel speed [-1, 1], default 0\n" "--speed=<double> ... accel speed [-1, 1], default 0\n"
"--dpi=<int> ... device resolution in DPI (default: 1000)\n"
"\n" "\n"
"If extra arguments are present and mode is not given, mode defaults to 'sequence'\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" "and the arguments are interpreted as sequence of delta x coordinates\n"
@ -191,18 +192,17 @@ main(int argc, char **argv)
print_sequence = false; print_sequence = false;
double custom_deltas[1024]; double custom_deltas[1024];
double speed = 0.0; double speed = 0.0;
int dpi = 1000;
enum { enum {
OPT_MODE = 1, OPT_MODE = 1,
OPT_NEVENTS, OPT_NEVENTS,
OPT_MAXDX, OPT_MAXDX,
OPT_STEP, OPT_STEP,
OPT_SPEED, OPT_SPEED,
OPT_DPI,
}; };
filter = create_pointer_accelerator_filter(pointer_accel_profile_linear,
1000);
assert(filter != NULL);
while (1) { while (1) {
int c; int c;
int option_index = 0; int option_index = 0;
@ -212,6 +212,7 @@ main(int argc, char **argv)
{"maxdx", 1, 0, OPT_MAXDX }, {"maxdx", 1, 0, OPT_MAXDX },
{"step", 1, 0, OPT_STEP }, {"step", 1, 0, OPT_STEP },
{"speed", 1, 0, OPT_SPEED }, {"speed", 1, 0, OPT_SPEED },
{"dpi", 1, 0, OPT_DPI },
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -259,6 +260,9 @@ main(int argc, char **argv)
case OPT_SPEED: case OPT_SPEED:
speed = strtod(optarg, NULL); speed = strtod(optarg, NULL);
break; break;
case OPT_DPI:
dpi = strtod(optarg, NULL);
break;
default: default:
usage(); usage();
exit(1); exit(1);
@ -266,6 +270,9 @@ main(int argc, char **argv)
} }
} }
filter = create_pointer_accelerator_filter(pointer_accel_profile_linear,
dpi);
assert(filter != NULL);
filter_set_speed(filter, speed); filter_set_speed(filter, speed);
if (!isatty(STDIN_FILENO)) { if (!isatty(STDIN_FILENO)) {