summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 7f3f788c..189cdf84 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -955,6 +955,19 @@ void CInputManager::setPointerConfigs() {
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
} else if (ACCELPROFILE == "flat") {
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
+ } else if (ACCELPROFILE.find("custom") == 0) {
+ CVarList args = {ACCELPROFILE, 0, ' '};
+ try {
+ double step = std::stod(args[1]);
+ std::vector<double> points;
+ for (size_t i = 2; i < args.size(); ++i)
+ points.push_back(std::stod(args[i]));
+
+ const auto CONFIG = libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
+ libinput_config_accel_set_points(CONFIG, LIBINPUT_ACCEL_TYPE_MOTION, step, points.size(), points.data());
+ libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
+ libinput_config_accel_destroy(CONFIG);
+ } catch (std::exception& e) { Debug::log(ERR, "Invalid values in custom accel profile"); }
} else {
Debug::log(WARN, "Unknown acceleration profile, falling back to default");
}