mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-21 18:00:37 +01:00
tools: support sendevents mode in debug-events
Disabling sendevents was already supported via an fnmatch() and --disable-sendevents but to test things like disabling on an external mouse, let's expose this option too. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1152>
This commit is contained in:
parent
67428b64e0
commit
4ac52b4f1b
3 changed files with 23 additions and 0 deletions
|
|
@ -132,6 +132,11 @@ Set the button to the given button code
|
|||
.B \-\-set\-scroll\-method=[none|twofinger|edge|button]
|
||||
Set the desired scroll method
|
||||
.TP 8
|
||||
.B \-\-set\-sendevents=[disabled|enabled|disabled-on-external-mouse]
|
||||
Set the given sendevents mode. This option overrides
|
||||
\fB\-\-disable-sendevents="pattern"\fR for any devices it matches
|
||||
via the \fB\-\-apply-to="pattern"\fR option.
|
||||
.TP 8
|
||||
.B \-\-set\-speed=<value>
|
||||
Set pointer acceleration speed. The allowed range is [-1, 1].
|
||||
This only applies to the flat or adaptive profile.
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ tools_init_options(struct tools_options *options)
|
|||
options->area.y1 = 0.0;
|
||||
options->area.x2 = 1.0;
|
||||
options->area.y2 = 1.0;
|
||||
options->sendevents = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -311,6 +312,18 @@ tools_parse_option(int option,
|
|||
"%s",
|
||||
optarg);
|
||||
break;
|
||||
case OPT_SENDEVENTS:
|
||||
if (streq(optarg, "disabled"))
|
||||
options->sendevents = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED;
|
||||
else if (streq(optarg, "enabled"))
|
||||
options->sendevents = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
|
||||
else if (streq(optarg, "disabled-on-external-mouse"))
|
||||
options->sendevents = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
|
||||
else {
|
||||
fprintf(stderr, "Invalid sendevents mode: %s\n", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case OPT_APPLY_TO:
|
||||
if (!optarg)
|
||||
return 1;
|
||||
|
|
@ -573,6 +586,8 @@ tools_device_apply_config(struct libinput_device *device,
|
|||
fnmatch(options->match, name, 0) == FNM_NOMATCH)
|
||||
return;
|
||||
|
||||
libinput_device_config_send_events_set_mode(device, options->sendevents);
|
||||
|
||||
if (options->tapping != -1)
|
||||
libinput_device_config_tap_set_enabled(device, options->tapping);
|
||||
if (options->tap_map != (enum libinput_config_tap_button_map)-1)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ enum configuration_options {
|
|||
OPT_CALIBRATION,
|
||||
OPT_AREA,
|
||||
OPT_3FG_DRAG,
|
||||
OPT_SENDEVENTS,
|
||||
};
|
||||
|
||||
#define CONFIGURATION_OPTIONS \
|
||||
|
|
@ -100,6 +101,7 @@ enum configuration_options {
|
|||
{ "set-profile", required_argument, 0, OPT_PROFILE }, \
|
||||
{ "set-tap-map", required_argument, 0, OPT_TAP_MAP }, \
|
||||
{ "set-speed", required_argument, 0, OPT_SPEED },\
|
||||
{ "set-sendevents", required_argument, 0, OPT_SENDEVENTS },\
|
||||
{ "apply-to", required_argument, 0, OPT_APPLY_TO },\
|
||||
{ "set-custom-points", required_argument, 0, OPT_CUSTOM_POINTS },\
|
||||
{ "set-custom-step", required_argument, 0, OPT_CUSTOM_STEP },\
|
||||
|
|
@ -144,6 +146,7 @@ struct tools_options {
|
|||
float calibration[6];
|
||||
struct libinput_config_area_rectangle area;
|
||||
enum libinput_config_3fg_drag_state drag_3fg;
|
||||
enum libinput_config_send_events_mode sendevents;
|
||||
};
|
||||
|
||||
void tools_init_options(struct tools_options *options);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue