diff --git a/.build.yml b/.build.yml
index 0bfafc9..aa3394c 100644
--- a/.build.yml
+++ b/.build.yml
@@ -3,12 +3,13 @@
#
image: archlinux
packages:
- - meson
- - wayland
- - wayland-protocols
+ - libevdev
- libinput
- libxkbcommon
- libxml2
+ - meson
+ - wayland
+ - wayland-protocols
- wlroots
- xorg-server-xwayland
sources:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 061bdbc..c2277cf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -18,7 +18,7 @@ jobs:
run: |
pacman-key --init
pacman -Syu --noconfirm
- pacman -S --noconfirm git meson libxkbcommon libinput libxml2 wayland wayland-protocols wlroots xorg-server-xwayland
+ pacman -S --noconfirm git libevdev libinput libxkbcommon libxml2 meson wayland wayland-protocols wlroots xorg-server-xwayland
# actions/checkout@v2 clones the repository
- uses: actions/checkout@v2
- name: setup
diff --git a/README.md b/README.md
index d009fbf..2b21ccd 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ contributing.](https://github.com/wizbright/waybox/blob/master/CONTRIBUTING.md)
* [Meson](https://mesonbuild.com/)
* [Wayland](https://wayland.freedesktop.org/)
+* [libevdev](https://www.freedesktop.org/wiki/Software/libevdev/)
* [libinput](http://www.freedesktop.org/wiki/Software/libinput)
* [libxml2](http://xmlsoft.org/)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots/)
diff --git a/data/rc.xml b/data/rc.xml
index 2f6ce06..ea2b38a 100644
--- a/data/rc.xml
+++ b/data/rc.xml
@@ -119,6 +119,7 @@
disabled
enabled
disabled
+ BTN_MIDDLE
disabled
twofinger
enabled
diff --git a/meson.build b/meson.build
index 22065cc..544bac8 100644
--- a/meson.build
+++ b/meson.build
@@ -25,6 +25,7 @@ cc = meson.get_compiler('c')
# Adding include directory
inc_dir = include_directories('include')
+libevdev = dependency('libevdev')
libinput = dependency('libinput', version: '>=1.21.0')
libxml2 = dependency('libxml-2.0')
wlroots = dependency('wlroots', version: '>=0.16.0')
diff --git a/waybox/config.c b/waybox/config.c
index 7958c49..2e7ce9c 100644
--- a/waybox/config.c
+++ b/waybox/config.c
@@ -186,6 +186,7 @@ bool init_config(struct wb_server *server) {
config->libinput_config.left_handed = parse_xpath_expr("//ob:mouse//ob:libinput/ob:leftHanded", ctxt);
config->libinput_config.middle_emulation = parse_xpath_expr("//ob:mouse//ob:libinput/ob:middleEmulation", ctxt);
config->libinput_config.natural_scroll = parse_xpath_expr("//ob:mouse//ob:libinput/ob:naturalScroll", ctxt);
+ config->libinput_config.scroll_button = parse_xpath_expr("//ob:mouse//ob:libinput/ob:scrollButton", ctxt);
config->libinput_config.scroll_button_lock = parse_xpath_expr("//ob:mouse//ob:libinput/ob:scrollButtonLock", ctxt);
config->libinput_config.scroll_method = parse_xpath_expr("//ob:mouse//ob:libinput/ob:scrollMethod", ctxt);
config->libinput_config.tap = parse_xpath_expr("//ob:mouse//ob:libinput/ob:tap", ctxt);
diff --git a/waybox/config.h b/waybox/config.h
index b3375ae..468e1b8 100644
--- a/waybox/config.h
+++ b/waybox/config.h
@@ -37,6 +37,7 @@ struct wb_config {
char *left_handed;
char *middle_emulation;
char *natural_scroll;
+ char *scroll_button;
char *scroll_button_lock;
char *scroll_method;
char *tap;
diff --git a/waybox/meson.build b/waybox/meson.build
index e6280e9..8ce249b 100644
--- a/waybox/meson.build
+++ b/waybox/meson.build
@@ -11,6 +11,7 @@ wb_src = files(
)
wb_dep = [
+ libevdev,
libinput,
libxml2,
wayland_server,
diff --git a/waybox/seat.c b/waybox/seat.c
index b6f5f1d..2490995 100644
--- a/waybox/seat.c
+++ b/waybox/seat.c
@@ -1,3 +1,4 @@
+#include
#include
#include
@@ -287,7 +288,7 @@ static void handle_new_pointer(struct wb_server *server, struct wlr_input_device
enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
if (strcmp(config->libinput_config.click_method, "clickfinger") == 0)
click_method = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
- else if (strcmp(config->libinput_config.scroll_method, "none") == 0)
+ else if (strcmp(config->libinput_config.click_method, "none") == 0)
click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
libinput_device_config_click_set_method(libinput_handle, click_method);
}
@@ -311,6 +312,12 @@ static void handle_new_pointer(struct wb_server *server, struct wlr_input_device
libinput_device_config_scroll_set_natural_scroll_enabled(libinput_handle,
libinput_config_get_enabled(config->libinput_config.natural_scroll));
}
+ if (config->libinput_config.scroll_button) {
+ int button = libevdev_event_code_from_name(EV_KEY, config->libinput_config.scroll_button);
+ if (button != -1) {
+ libinput_device_config_scroll_set_button(libinput_handle, button);
+ }
+ }
if (config->libinput_config.scroll_button_lock) {
libinput_device_config_scroll_set_button_lock(libinput_handle,
libinput_config_get_enabled(config->libinput_config.scroll_button_lock));