tools: add --disable-sendevents option to the debug-events/debug-gui tools

Makes it possible to debug issues with sendevents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-09-05 14:12:09 +10:00
parent 407649e599
commit 5252fa5d88
3 changed files with 25 additions and 0 deletions

View file

@ -44,6 +44,9 @@ The default behavior is equivalent to \-\-udev "seat0".
Use verbose output
.SS libinput configuration options
.TP 8
.B \-\-disable-sendevents="pattern"
Set the send-events option to disabled for the devices matching patterns.
.TP 8
.B \-\-enable\-tap|\-\-disable\-tap
Enable or disable tap-to-click
.TP 8

View file

@ -25,6 +25,7 @@
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
@ -208,6 +209,15 @@ tools_parse_option(int option,
else
return 1;
break;
case OPT_DISABLE_SENDEVENTS:
if (!optarg)
return 1;
snprintf(options->disable_pattern,
sizeof(options->disable_pattern),
"%s",
optarg);
break;
}
return 0;
@ -367,6 +377,15 @@ tools_device_apply_config(struct libinput_device *device,
libinput_device_config_accel_set_profile(device,
options->profile);
}
if (libinput_device_config_send_events_get_modes(device) &
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED &&
fnmatch(options->disable_pattern,
libinput_device_get_name(device),
0) != FNM_NOMATCH) {
libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
}
}
static char*

View file

@ -49,9 +49,11 @@ enum configuration_options {
OPT_SCROLL_BUTTON,
OPT_SPEED,
OPT_PROFILE,
OPT_DISABLE_SENDEVENTS,
};
#define CONFIGURATION_OPTIONS \
{ "disable-sendevents", required_argument, 0, OPT_DISABLE_SENDEVENTS }, \
{ "enable-tap", no_argument, 0, OPT_TAP_ENABLE }, \
{ "disable-tap", no_argument, 0, OPT_TAP_DISABLE }, \
{ "enable-drag", no_argument, 0, OPT_DRAG_ENABLE }, \
@ -92,6 +94,7 @@ struct tools_options {
double speed;
int dwt;
enum libinput_config_accel_profile profile;
char disable_pattern[64];
};
void tools_init_options(struct tools_options *options);