mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 15:50:29 +01:00
tools: add click method config to the tools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
5c7f2a1949
commit
7ce25592d9
2 changed files with 27 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ enum options {
|
|||
OPT_NATURAL_SCROLL_DISABLE,
|
||||
OPT_LEFT_HANDED_ENABLE,
|
||||
OPT_LEFT_HANDED_DISABLE,
|
||||
OPT_CLICK_METHOD,
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -69,6 +70,7 @@ tools_usage()
|
|||
"--disable-natural-scrolling.... enable/disable natural scrolling\n"
|
||||
"--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"
|
||||
"\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"
|
||||
|
|
@ -86,6 +88,7 @@ tools_init_options(struct tools_options *options)
|
|||
options->tapping = -1;
|
||||
options->natural_scroll = -1;
|
||||
options->left_handed = -1;
|
||||
options->click_method = -1;
|
||||
options->backend = BACKEND_UDEV;
|
||||
options->seat = "seat0";
|
||||
}
|
||||
|
|
@ -107,6 +110,7 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
|
|||
{ "disable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_DISABLE },
|
||||
{ "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 },
|
||||
{ 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
@ -153,6 +157,25 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
|
|||
case OPT_LEFT_HANDED_DISABLE:
|
||||
options->left_handed = 0;
|
||||
break;
|
||||
case OPT_CLICK_METHOD:
|
||||
if (!optarg) {
|
||||
tools_usage();
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(optarg, "none") == 0) {
|
||||
options->click_method =
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
||||
} else if (strcmp(optarg, "clickfinger") == 0) {
|
||||
options->click_method =
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
||||
} else if (strcmp(optarg, "buttonareas") == 0) {
|
||||
options->click_method =
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
||||
} else {
|
||||
tools_usage();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
tools_usage();
|
||||
return 1;
|
||||
|
|
@ -263,4 +286,7 @@ tools_device_apply_config(struct libinput_device *device,
|
|||
options->natural_scroll);
|
||||
if (options->left_handed != -1)
|
||||
libinput_device_config_left_handed_set(device, options->left_handed);
|
||||
|
||||
if (options->click_method != -1)
|
||||
libinput_device_config_click_set_method(device, options->click_method);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ struct tools_options {
|
|||
int tapping;
|
||||
int natural_scroll;
|
||||
int left_handed;
|
||||
enum libinput_config_click_method click_method;
|
||||
};
|
||||
|
||||
void tools_init_options(struct tools_options *options);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue