summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-12-18 15:14:09 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-12-23 10:50:31 +1000
commit363a7f783f9f18fa4142ba2911a18a61625f2ce7 (patch)
tree9c742564cdfd9151d9711bd3f8ff226476a262b3 /tools
parent333f4e0347e32e8e67fca30527bac490beee76e6 (diff)
downloadlibinput-363a7f783f9f18fa4142ba2911a18a61625f2ce7.tar.gz
tools: add support for enabling/disabling left-handed button mappings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/shared.c15
-rw-r--r--tools/shared.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/tools/shared.c b/tools/shared.c
index 623005e5..8439cb27 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -41,6 +41,8 @@ enum options {
OPT_TAP_DISABLE,
OPT_NATURAL_SCROLL_ENABLE,
OPT_NATURAL_SCROLL_DISABLE,
+ OPT_LEFT_HANDED_ENABLE,
+ OPT_LEFT_HANDED_DISABLE,
};
static void
@@ -65,6 +67,8 @@ tools_usage()
"--disable-tap.... enable/disable tapping\n"
"--enable-natural-scrolling\n"
"--disable-natural-scrolling.... enable/disable natural scrolling\n"
+ "--enable-left-handed\n"
+ "--disable-left-handed.... enable/disable left-handed button configuration\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"
@@ -81,6 +85,7 @@ tools_init_options(struct tools_options *options)
memset(options, 0, sizeof(*options));
options->tapping = -1;
options->natural_scroll = -1;
+ options->left_handed = -1;
options->backend = BACKEND_UDEV;
options->seat = "seat0";
}
@@ -100,6 +105,8 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
{ "disable-tap", 0, 0, OPT_TAP_DISABLE },
{ "enable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_ENABLE },
{ "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 },
{ 0, 0, 0, 0}
};
@@ -140,6 +147,12 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
case OPT_NATURAL_SCROLL_DISABLE:
options->natural_scroll = 0;
break;
+ case OPT_LEFT_HANDED_ENABLE:
+ options->left_handed = 1;
+ break;
+ case OPT_LEFT_HANDED_DISABLE:
+ options->left_handed = 0;
+ break;
default:
tools_usage();
return 1;
@@ -245,4 +258,6 @@ tools_device_apply_config(struct libinput_device *device,
if (options->natural_scroll != -1)
libinput_device_config_scroll_set_natural_scroll_enabled(device,
options->natural_scroll);
+ if (options->left_handed != -1)
+ libinput_device_config_buttons_set_left_handed(device, options->left_handed);
}
diff --git a/tools/shared.h b/tools/shared.h
index e33fe04f..9ecd3adb 100644
--- a/tools/shared.h
+++ b/tools/shared.h
@@ -38,6 +38,7 @@ struct tools_options {
int verbose;
int tapping;
int natural_scroll;
+ int left_handed;
};
void tools_init_options(struct tools_options *options);