aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGabriel Ford <[email protected]>2024-04-20 11:26:48 +0000
committerGitHub <[email protected]>2024-04-20 12:26:48 +0100
commit5c97b96278da672405527b84019ab50395a9f74f (patch)
treebc0bce8b4b4d96f7bee50302f4ae8e6491bd12de
parent10caa03ce5bc2ce8238c494d59405213d32ddead (diff)
downloadHyprland-5c97b96278da672405527b84019ab50395a9f74f.tar.gz
Hyprland-5c97b96278da672405527b84019ab50395a9f74f.zip
config: Allow more sensible input options for enabling animations. (#5659)
* Add check for on/off and true/false. * Cleanup feature and comment it out. * Use already created helper function for this. * Fix comparing int to char* ptr
-rw-r--r--src/config/ConfigManager.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index f959e3a0..05694832 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1786,12 +1786,15 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
PANIM->second.overridden = true;
PANIM->second.pValues = &PANIM->second;
- // on/off
- PANIM->second.internalEnabled = ARGS[1] == "1";
+ // This helper casts strings like "1", "true", "off", "yes"... to int.
+ int64_t enabledInt = configStringToInt(ARGS[1]) == 1;
- if (ARGS[1] != "0" && ARGS[1] != "1")
+ // Checking that the int is 1 or 0 because the helper can return integers out of range.
+ if (enabledInt != 0 && enabledInt != 1)
return "invalid animation on/off state";
+ PANIM->second.internalEnabled = configStringToInt(ARGS[1]) == 1;
+
if (PANIM->second.internalEnabled) {
// speed
if (isNumber(ARGS[2], true)) {