tools: hook up drag lock config

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-22 11:07:31 +10:00
parent 875e1d1b10
commit 16107e1862
3 changed files with 23 additions and 1 deletions

View file

@ -157,8 +157,13 @@ print_device_notify(struct libinput_event *ev)
if (libinput_device_get_size(dev, &w, &h) == 0)
printf("\tsize %.2f/%.2fmm", w, h);
if (libinput_device_config_tap_get_finger_count(dev))
if (libinput_device_config_tap_get_finger_count(dev)) {
printf(" tap");
if (libinput_device_config_tap_get_drag_lock_enabled(dev))
printf("(dl on)");
else
printf("(dl off)");
}
if (libinput_device_config_left_handed_is_available(dev))
printf(" left");
if (libinput_device_config_scroll_has_natural_scroll(dev))

View file

@ -43,6 +43,8 @@ enum options {
OPT_VERBOSE,
OPT_TAP_ENABLE,
OPT_TAP_DISABLE,
OPT_DRAG_LOCK_ENABLE,
OPT_DRAG_LOCK_DISABLE,
OPT_NATURAL_SCROLL_ENABLE,
OPT_NATURAL_SCROLL_DISABLE,
OPT_LEFT_HANDED_ENABLE,
@ -75,6 +77,8 @@ tools_usage()
"Features:\n"
"--enable-tap\n"
"--disable-tap.... enable/disable tapping\n"
"--enable-drag-lock\n"
"--disable-drag-lock.... enable/disable tapping drag lock\n"
"--enable-natural-scrolling\n"
"--disable-natural-scrolling.... enable/disable natural scrolling\n"
"--enable-left-handed\n"
@ -100,6 +104,7 @@ tools_init_options(struct tools_options *options)
{
memset(options, 0, sizeof(*options));
options->tapping = -1;
options->drag_lock = -1;
options->natural_scroll = -1;
options->left_handed = -1;
options->middlebutton = -1;
@ -124,6 +129,8 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
{ "verbose", 0, 0, OPT_VERBOSE },
{ "enable-tap", 0, 0, OPT_TAP_ENABLE },
{ "disable-tap", 0, 0, OPT_TAP_DISABLE },
{ "enable-drag-lock", 0, 0, OPT_DRAG_LOCK_ENABLE },
{ "disable-drag-lock", 0, 0, OPT_DRAG_LOCK_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 },
@ -168,6 +175,12 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
case OPT_TAP_DISABLE:
options->tapping = 0;
break;
case OPT_DRAG_LOCK_ENABLE:
options->drag_lock = 1;
break;
case OPT_DRAG_LOCK_DISABLE:
options->drag_lock = 0;
break;
case OPT_NATURAL_SCROLL_ENABLE:
options->natural_scroll = 1;
break;
@ -354,6 +367,9 @@ tools_device_apply_config(struct libinput_device *device,
{
if (options->tapping != -1)
libinput_device_config_tap_set_enabled(device, options->tapping);
if (options->drag_lock != -1)
libinput_device_config_tap_set_drag_lock_enabled(device,
options->drag_lock);
if (options->natural_scroll != -1)
libinput_device_config_scroll_set_natural_scroll_enabled(device,
options->natural_scroll);

View file

@ -38,6 +38,7 @@ struct tools_options {
int verbose;
int tapping;
int drag_lock;
int natural_scroll;
int left_handed;
int middlebutton;