mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 17:05:58 +01:00
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
This commit is contained in:
parent
10caa03ce5
commit
5c97b96278
1 changed files with 6 additions and 3 deletions
|
@ -1786,12 +1786,15 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
|
||||||
PANIM->second.overridden = true;
|
PANIM->second.overridden = true;
|
||||||
PANIM->second.pValues = &PANIM->second;
|
PANIM->second.pValues = &PANIM->second;
|
||||||
|
|
||||||
// on/off
|
// This helper casts strings like "1", "true", "off", "yes"... to int.
|
||||||
PANIM->second.internalEnabled = ARGS[1] == "1";
|
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";
|
return "invalid animation on/off state";
|
||||||
|
|
||||||
|
PANIM->second.internalEnabled = configStringToInt(ARGS[1]) == 1;
|
||||||
|
|
||||||
if (PANIM->second.internalEnabled) {
|
if (PANIM->second.internalEnabled) {
|
||||||
// speed
|
// speed
|
||||||
if (isNumber(ARGS[2], true)) {
|
if (isNumber(ARGS[2], true)) {
|
||||||
|
|
Loading…
Reference in a new issue