From 0287678092e5ed076d417c2241244c0211798e9d Mon Sep 17 00:00:00 2001 From: nullsystem Date: Wed, 19 Nov 2025 00:01:54 +0000 Subject: [PATCH] [PATCH] perinputconfig-pointer - 2025-11-19 Update * Array replaced singular variables for configuration * Only applies to enable-state, acceleration profile, and speed * Like EX: Rules, requires NULL/default set at the end * 2025-11-19: Split keyboard and pointer into two patches --- config.def.h | 19 +++++++++++++------ dwl.c | 19 ++++++++++++++++--- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/config.def.h b/config.def.h index 95c2afa..81ba5a2 100644 --- a/config.def.h +++ b/config.def.h @@ -86,19 +86,26 @@ LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER */ static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; -/* You can choose between: +/* +send_events_mode: You can choose between: LIBINPUT_CONFIG_SEND_EVENTS_ENABLED LIBINPUT_CONFIG_SEND_EVENTS_DISABLED LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE -*/ -static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; -/* You can choose between: +accel_profile: You can choose between: LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + +NOTE: Always include a fallback rule at the end (name as NULL) */ -static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE; -static const double accel_speed = 0.0; +static const InputRule inputrules[] = { + /* name send_events_mode accel_profile accel_speed */ + /* examples: + { "SynPS/2 Synaptics TouchPad", LIBINPUT_CONFIG_SEND_EVENTS_DISABLED, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT, 0.0 }, + { "TPPS/2 IBM TrackPoint", LIBINPUT_CONFIG_SEND_EVENTS_ENABLED, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, 0.0 }, + */ + { NULL, LIBINPUT_CONFIG_SEND_EVENTS_ENABLED, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, 0.0 }, +}; /* You can choose between: LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle diff --git a/dwl.c b/dwl.c index 12f441e..47240b6 100644 --- a/dwl.c +++ b/dwl.c @@ -239,6 +239,13 @@ typedef struct { struct wl_listener destroy; } SessionLock; +typedef struct { + const char *name; + uint32_t send_events_mode; + enum libinput_config_accel_profile accel_profile; + double accel_speed; +} InputRule; + /* function declarations */ static void applybounds(Client *c, struct wlr_box *bbox); static void applyrules(Client *c); @@ -1140,9 +1147,15 @@ createnotify(struct wl_listener *listener, void *data) void createpointer(struct wlr_pointer *pointer) { + const InputRule *irule; struct libinput_device *device; if (wlr_input_device_is_libinput(&pointer->base) && (device = wlr_libinput_get_device_handle(&pointer->base))) { + const char *device_name = libinput_device_get_name(device); + for (irule = inputrules; irule < END(inputrules); irule++) { + if (!irule->name || strstr(device_name, irule->name)) + break; + } if (libinput_device_config_tap_get_finger_count(device)) { libinput_device_config_tap_set_enabled(device, tap_to_click); @@ -1170,11 +1183,11 @@ createpointer(struct wlr_pointer *pointer) libinput_device_config_click_set_method(device, click_method); if (libinput_device_config_send_events_get_modes(device)) - libinput_device_config_send_events_set_mode(device, send_events_mode); + libinput_device_config_send_events_set_mode(device, irule->send_events_mode); if (libinput_device_config_accel_is_available(device)) { - libinput_device_config_accel_set_profile(device, accel_profile); - libinput_device_config_accel_set_speed(device, accel_speed); + libinput_device_config_accel_set_profile(device, irule->accel_profile); + libinput_device_config_accel_set_speed(device, irule->accel_speed); } } -- 2.52.0