input/config: add button scroll lock (#3189)

This commit is contained in:
unrealhoang 2023-09-06 21:54:48 +09:00 committed by GitHub
parent 8b9cc9a8db
commit f90a009e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -201,6 +201,7 @@ void CConfigManager::setDefaultVars() {
configValues["input:left_handed"].intValue = 0;
configValues["input:scroll_method"].strValue = STRVAL_EMPTY;
configValues["input:scroll_button"].intValue = 0;
configValues["input:scroll_button_lock"].intValue = 0;
configValues["input:touchpad:natural_scroll"].intValue = 0;
configValues["input:touchpad:disable_while_typing"].intValue = 1;
configValues["input:touchpad:clickfinger_behavior"].intValue = 0;
@ -265,6 +266,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
cfgValues["left_handed"].intValue = 0;
cfgValues["scroll_method"].strValue = STRVAL_EMPTY;
cfgValues["scroll_button"].intValue = 0;
cfgValues["scroll_button_lock"].intValue = 0;
cfgValues["transform"].intValue = 0;
cfgValues["output"].strValue = STRVAL_EMPTY;
cfgValues["enabled"].intValue = 1; // only for mice / touchpads

View file

@ -1030,6 +1030,10 @@ void CInputManager::setPointerConfigs() {
libinput_device_config_scroll_set_button(LIBINPUTDEV, SCROLLBUTTON == 0 ? libinput_device_config_scroll_get_default_button(LIBINPUTDEV) : SCROLLBUTTON);
const auto SCROLLBUTTONLOCK = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "scroll_button_lock", 0) : g_pConfigManager->getInt("input:scroll_button_lock");
libinput_device_config_scroll_set_button_lock(LIBINPUTDEV, SCROLLBUTTONLOCK == 0 ? LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED : LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED);
Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m.name.c_str(), LIBINPUTSENS);
}
}