From 4f1e557d3d26ee8359750dce8f370d404513a1ca Mon Sep 17 00:00:00 2001 From: will Date: Sat, 17 Oct 2020 13:52:53 +0200 Subject: Added basic tap-to-click for touchpad users --- Makefile | 2 +- config.def.h | 4 ++++ dwl.c | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index abbbe39..bf0b957 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99 -Werror=declaration-after-statement WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols) WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner) -PKGS = wlroots wayland-server xcb xkbcommon +PKGS = wlroots wayland-server xcb xkbcommon libinput CFLAGS += $(foreach p,$(PKGS),$(shell pkg-config --cflags $(p))) LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p))) diff --git a/config.def.h b/config.def.h index 53021cf..c1ad7d6 100644 --- a/config.def.h +++ b/config.def.h @@ -41,6 +41,10 @@ static const struct xkb_rule_names xkb_rules = { .options = "ctrl:nocaps", */ }; + +/* Trackpad */ +int tap_to_click = 1; + static const int repeat_rate = 25; static const int repeat_delay = 600; diff --git a/dwl.c b/dwl.c index 2257222..2907c5f 100644 --- a/dwl.c +++ b/dwl.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,7 @@ #include #include #include +#include #include #include #ifdef XWAYLAND @@ -970,6 +972,10 @@ createlayersurface(struct wl_listener *listener, void *data) void createpointer(struct wlr_input_device *device) { + struct libinput_device *libinput_device = (struct libinput_device*) + wlr_libinput_get_device_handle(device); + if (tap_to_click && libinput_device_config_tap_get_finger_count(libinput_device)) + libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED); /* We don't do anything special with pointers. All of our pointer handling * is proxied through wlr_cursor. On another compositor, you might take this * opportunity to do libinput configuration on the device to set -- cgit v1.2.3