From eb86e7967f7d218a7c9412e484473fd578dbf64c Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 21 Nov 2022 23:26:18 +0000 Subject: add scroll_button libinput opt --- src/config/ConfigManager.cpp | 2 ++ src/managers/input/InputManager.cpp | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 83ecd3f4..ec87ef20 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -142,6 +142,7 @@ void CConfigManager::setDefaultVars() { configValues["input:float_switch_override_focus"].intValue = 1; configValues["input:left_handed"].intValue = 0; configValues["input:scroll_method"].strValue = STRVAL_EMPTY; + configValues["input:scroll_button"].intValue = 0; configValues["input:touchpad:natural_scroll"].intValue = 0; configValues["input:touchpad:disable_while_typing"].intValue = 1; configValues["input:touchpad:clickfinger_behavior"].intValue = 0; @@ -193,6 +194,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) { cfgValues["drag_lock"].intValue = 0; cfgValues["left_handed"].intValue = 0; cfgValues["scroll_method"].strValue = STRVAL_EMPTY; + cfgValues["scroll_button"].intValue = 0; cfgValues["touch_transform"].intValue = 0; cfgValues["touch_output"].strValue = STRVAL_EMPTY; cfgValues["enabled"].intValue = 1; // only for mice / touchpads diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 24bab360..17a67020 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -779,7 +779,11 @@ void CInputManager::setPointerConfigs() { libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); } else { Debug::log(WARN, "Unknown acceleration profile, falling back to default"); - } + } + + const auto SCROLLBUTTON = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "scroll_button") : g_pConfigManager->getInt("input:scroll_button"); + + libinput_device_config_scroll_set_button(LIBINPUTDEV, SCROLLBUTTON == 0 ? libinput_device_config_scroll_get_default_button(LIBINPUTDEV) : SCROLLBUTTON); Debug::log(LOG, "Applied config to mouse %s, sens %.2f", m.name.c_str(), LIBINPUTSENS); } -- cgit v1.2.3