From 92800d7866dfcbe3a985258e544b81ac8bf2c056 Mon Sep 17 00:00:00 2001 From: Sevz17 Date: Sun, 4 Apr 2021 22:31:13 -0500 Subject: [PATCH] Now is possible change the pointer speed and change the accel profile --- config.def.h | 10 ++++++++++ dwl.c | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/config.def.h b/config.def.h index 089aa37..f4d2d4d 100644 --- a/config.def.h +++ b/config.def.h @@ -51,6 +51,16 @@ static const int repeat_delay = 600; static const int tap_to_click = 1; static const int natural_scrolling = 0; +/* Define the accel profile, the posible values can be */ +/* LIBINPUT_CONFIG_ACCEL_PROFILE_NONE */ +/* LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT (this disables the acceleration). */ +/* LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE (this is the default profile for most devices). */ +#define ACCEL_PROFILE LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + +/* Set the pointer acceleration of this pointer device within a range of [-1,1]. */ +/* 0 is the default value, -1 is slowest acceleration and 1 is the maximun accel */ +static const double pointer_speed = 0; + #define MODKEY WLR_MODIFIER_ALT #define TAGKEYS(KEY,SKEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ diff --git a/dwl.c b/dwl.c index 54cfcfe..9a31533 100644 --- a/dwl.c +++ b/dwl.c @@ -949,6 +949,13 @@ createpointer(struct wlr_input_device *device) if (libinput_device_config_scroll_has_natural_scroll(libinput_device)) libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling); + + if (libinput_device_config_accel_is_available(libinput_device) && pointer_speed) + libinput_device_config_accel_set_speed(libinput_device, pointer_speed); + +#ifdef ACCEL_PROFILE + libinput_device_config_accel_set_profile(libinput_device, ACCEL_PROFILE); +#endif } /* We don't do anything special with pointers. All of our pointer handling