#include <string.h>
#include <libudev.h>
+#include <libevdev/libevdev.h>
+
#include "shared.h"
enum options {
OPT_MIDDLEBUTTON_DISABLE,
OPT_CLICK_METHOD,
OPT_SCROLL_METHOD,
+ OPT_SCROLL_BUTTON,
OPT_SPEED,
};
"--disable-middlebutton.... enable/disable middle button emulation\n"
"--set-click-method=[none|clickfinger|buttonareas] .... set the desired click method\n"
"--set-scroll-method=[none|twofinger|edge|button] ... set the desired scroll method\n"
+ "--set-scroll-button=BTN_MIDDLE ... set the button to the given button code\n"
"--set-speed=<value>.... set pointer acceleration speed\n"
"\n"
"These options apply to all applicable devices, if a feature\n"
options->middlebutton = -1;
options->click_method = -1;
options->scroll_method = -1;
+ options->scroll_button = -1;
options->backend = BACKEND_UDEV;
options->seat = "seat0";
options->speed = 0.0;
{ "disable-middlebutton", 0, 0, OPT_MIDDLEBUTTON_DISABLE },
{ "set-click-method", 1, 0, OPT_CLICK_METHOD },
{ "set-scroll-method", 1, 0, OPT_SCROLL_METHOD },
+ { "set-scroll-button", 1, 0, OPT_SCROLL_BUTTON },
{ "speed", 1, 0, OPT_SPEED },
{ 0, 0, 0, 0}
};
return 1;
}
break;
+ case OPT_SCROLL_BUTTON:
+ if (!optarg) {
+ tools_usage();
+ return 1;
+ }
+ options->scroll_button =
+ libevdev_event_code_from_name(EV_KEY,
+ optarg);
+ if (options->scroll_button == -1) {
+ fprintf(stderr,
+ "Invalid button %s\n",
+ optarg);
+ return 1;
+ }
+ break;
case OPT_SPEED:
if (!optarg) {
tools_usage();
if (options->scroll_method != -1)
libinput_device_config_scroll_set_method(device,
options->scroll_method);
+ if (options->scroll_button != -1)
+ libinput_device_config_scroll_set_button(device,
+ options->scroll_button);
if (libinput_device_config_accel_is_available(device))
libinput_device_config_accel_set_speed(device,