tools: add click method config to the tools
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 16 Jan 2015 00:16:47 +0000 (10:16 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 16 Jan 2015 00:35:00 +0000 (10:35 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/shared.c
tools/shared.h

index b4f41d0..2cff52c 100644 (file)
@@ -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);
 }
index 4388cea..fcf748f 100644 (file)
@@ -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);