mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 22:05:58 +01:00
input: add custom accel profiles
This commit is contained in:
parent
c0be1e2fd8
commit
0859944c9a
1 changed files with 13 additions and 0 deletions
|
@ -955,6 +955,19 @@ void CInputManager::setPointerConfigs() {
|
||||||
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
|
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
|
||||||
} else if (ACCELPROFILE == "flat") {
|
} else if (ACCELPROFILE == "flat") {
|
||||||
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_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 {
|
} else {
|
||||||
Debug::log(WARN, "Unknown acceleration profile, falling back to default");
|
Debug::log(WARN, "Unknown acceleration profile, falling back to default");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue