mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-17 08:20:19 +01:00
tools: add commandline flag to control the pointer accel speed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c621656790
commit
2a1a28dd1d
2 changed files with 16 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ enum options {
|
|||
OPT_LEFT_HANDED_ENABLE,
|
||||
OPT_LEFT_HANDED_DISABLE,
|
||||
OPT_CLICK_METHOD,
|
||||
OPT_SPEED,
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -71,6 +72,7 @@ tools_usage()
|
|||
"--enable-left-handed\n"
|
||||
"--disable-left-handed.... enable/disable left-handed button configuration\n"
|
||||
"--set-click-method=[none|clickfinger|buttonareas] .... set the desired click method\n"
|
||||
"--set-speed=<value>.... set pointer acceleration speed\n"
|
||||
"\n"
|
||||
"These options apply to all applicable devices, if a feature\n"
|
||||
"is not explicitly specified it is left at each device's default.\n"
|
||||
|
|
@ -91,6 +93,7 @@ tools_init_options(struct tools_options *options)
|
|||
options->click_method = -1;
|
||||
options->backend = BACKEND_UDEV;
|
||||
options->seat = "seat0";
|
||||
options->speed = 0.0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -111,6 +114,7 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
|
|||
{ "enable-left-handed", 0, 0, OPT_LEFT_HANDED_ENABLE },
|
||||
{ "disable-left-handed", 0, 0, OPT_LEFT_HANDED_DISABLE },
|
||||
{ "set-click-method", 1, 0, OPT_CLICK_METHOD },
|
||||
{ "speed", 1, 0, OPT_SPEED },
|
||||
{ 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
@ -176,6 +180,13 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
|
|||
return 1;
|
||||
}
|
||||
break;
|
||||
case OPT_SPEED:
|
||||
if (!optarg) {
|
||||
tools_usage();
|
||||
return 1;
|
||||
}
|
||||
options->speed = atof(optarg);
|
||||
break;
|
||||
default:
|
||||
tools_usage();
|
||||
return 1;
|
||||
|
|
@ -289,4 +300,8 @@ tools_device_apply_config(struct libinput_device *device,
|
|||
|
||||
if (options->click_method != -1)
|
||||
libinput_device_config_click_set_method(device, options->click_method);
|
||||
|
||||
if (libinput_device_config_accel_is_available(device))
|
||||
libinput_device_config_accel_set_speed(device,
|
||||
options->speed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ struct tools_options {
|
|||
int natural_scroll;
|
||||
int left_handed;
|
||||
enum libinput_config_click_method click_method;
|
||||
double speed;
|
||||
};
|
||||
|
||||
void tools_init_options(struct tools_options *options);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue