Fixed oversights in libinput configuration

This commit is contained in:
Keith Bowes 2022-12-08 16:16:05 -05:00
parent 6c6d0214b4
commit e4b603a082
9 changed files with 19 additions and 5 deletions

View file

@ -3,12 +3,13 @@
#
image: archlinux
packages:
- meson
- wayland
- wayland-protocols
- libevdev
- libinput
- libxkbcommon
- libxml2
- meson
- wayland
- wayland-protocols
- wlroots
- xorg-server-xwayland
sources:

View file

@ -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

View file

@ -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/)

View file

@ -119,6 +119,7 @@
<leftHanded>disabled</leftHanded>
<middleEmulation>enabled</middleEmulation>
<naturalScroll>disabled</naturalScroll>
<scrollButton>BTN_MIDDLE</scrollButton>
<scrollButtonLock>disabled</scrollButtonLock>
<scrollMethod>twofinger</scrollMethod>
<tap>enabled</tap>

View file

@ -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')

View file

@ -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);

View file

@ -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;

View file

@ -11,6 +11,7 @@ wb_src = files(
)
wb_dep = [
libevdev,
libinput,
libxml2,
wayland_server,

View file

@ -1,3 +1,4 @@
#include <libevdev/libevdev.h>
#include <unistd.h>
#include <wlr/backend/libinput.h>
@ -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));