From e632bf176b04968ca6a22f6e5d5f1a7bf77b6fa6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 6 Jul 2023 16:26:38 +0200 Subject: config: fix reading touchpad values to non-touchpad per-device cfgs --- src/config/ConfigManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/config/ConfigManager.cpp') diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 822175ff..a4250293 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1654,7 +1654,7 @@ SConfigValue CConfigManager::getConfigValueSafe(const std::string& val) { return copy; } -SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, const std::string& val) { +SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, const std::string& val, std::optional touchpad) { std::lock_guard lg(configmtx); const auto it = deviceConfigs.find(dev); @@ -1673,8 +1673,8 @@ SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, co if (foundIt == std::string::npos) continue; - if (cv.first == "input:" + val || cv.first == "input:touchpad:" + val || cv.first == "input:touchdevice:" + val || cv.first == "input:tablet:" + val || - cv.first == "input:tablet:" + val) { + if (cv.first == "input:" + val || (touchpad.value_or(true) && cv.first == "input:touchpad:" + val) || cv.first == "input:touchdevice:" + val || + cv.first == "input:tablet:" + val || cv.first == "input:tablet:" + val) { copy = cv.second; } } @@ -1700,16 +1700,16 @@ std::string CConfigManager::getString(const std::string& v) { return VAL; } -int CConfigManager::getDeviceInt(const std::string& dev, const std::string& v) { - return getConfigValueSafeDevice(dev, v).intValue; +int CConfigManager::getDeviceInt(const std::string& dev, const std::string& v, std::optional touchpad) { + return getConfigValueSafeDevice(dev, v, touchpad).intValue; } -float CConfigManager::getDeviceFloat(const std::string& dev, const std::string& v) { - return getConfigValueSafeDevice(dev, v).floatValue; +float CConfigManager::getDeviceFloat(const std::string& dev, const std::string& v, std::optional touchpad) { + return getConfigValueSafeDevice(dev, v, touchpad).floatValue; } -std::string CConfigManager::getDeviceString(const std::string& dev, const std::string& v) { - auto VAL = getConfigValueSafeDevice(dev, v).strValue; +std::string CConfigManager::getDeviceString(const std::string& dev, const std::string& v, std::optional touchpad) { + auto VAL = getConfigValueSafeDevice(dev, v, touchpad).strValue; if (VAL == STRVAL_EMPTY) return ""; -- cgit v1.2.3