summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--config.def.h5
-rw-r--r--dwl.c13
3 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 56ab751..2409aa4 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..2c11fd3 100644
--- a/config.def.h
+++ b/config.def.h
@@ -41,6 +41,11 @@ static const struct xkb_rule_names xkb_rules = {
.options = "ctrl:nocaps",
*/
};
+
+/* Trackpad */
+int tap_to_click = 1;
+int natural_scrolling = 1;
+
static const int repeat_rate = 25;
static const int repeat_delay = 600;
diff --git a/dwl.c b/dwl.c
index 730e46a..c4c78f1 100644
--- a/dwl.c
+++ b/dwl.c
@@ -10,6 +10,7 @@
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
+#include <libinput.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/render/wlr_renderer.h>
@@ -33,6 +34,7 @@
#include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_xdg_shell.h>
+#include <wlr/backend/libinput.h>
#include <wlr/util/log.h>
#include <xkbcommon/xkbcommon.h>
#ifdef XWAYLAND
@@ -603,6 +605,15 @@ createnotify(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);
+
+ if (libinput_device_config_scroll_has_natural_scroll(libinput_device))
+ libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling);
+
/* 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
@@ -856,7 +867,7 @@ keypress(struct wl_listener *listener, void *data)
int handled = 0;
uint32_t mods = wlr_keyboard_get_modifiers(kb->device->keyboard);
/* On _press_, attempt to process a compositor keybinding. */
- if (event->state == WLR_KEY_PRESSED)
+ if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED)
for (i = 0; i < nsyms; i++)
handled = keybinding(mods, syms[i]) || handled;