config: loosen restrictions around animation keywords

Fixes #3185, makes hyprland ignore further args if an animation is disabled
This commit is contained in:
vaxerski 2023-09-06 12:58:01 +02:00
parent 61a71c65ac
commit 37e2311a3e

View file

@ -752,35 +752,37 @@ void CConfigManager::handleAnimation(const std::string& command, const std::stri
parseError = "invalid animation on/off state"; parseError = "invalid animation on/off state";
} }
// speed if (PANIM->second.internalEnabled) {
if (isNumber(ARGS[2], true)) { // speed
PANIM->second.internalSpeed = std::stof(ARGS[2]); if (isNumber(ARGS[2], true)) {
PANIM->second.internalSpeed = std::stof(ARGS[2]);
if (PANIM->second.internalSpeed <= 0) { if (PANIM->second.internalSpeed <= 0) {
parseError = "invalid speed";
PANIM->second.internalSpeed = 1.f;
}
} else {
PANIM->second.internalSpeed = 10.f;
parseError = "invalid speed"; parseError = "invalid speed";
PANIM->second.internalSpeed = 1.f;
} }
} else {
PANIM->second.internalSpeed = 10.f;
parseError = "invalid speed";
}
// curve // curve
PANIM->second.internalBezier = ARGS[3]; PANIM->second.internalBezier = ARGS[3];
if (!g_pAnimationManager->bezierExists(ARGS[3])) { if (!g_pAnimationManager->bezierExists(ARGS[3])) {
parseError = "no such bezier"; parseError = "no such bezier";
PANIM->second.internalBezier = "default"; PANIM->second.internalBezier = "default";
} }
// style // style
PANIM->second.internalStyle = ARGS[4]; PANIM->second.internalStyle = ARGS[4];
if (ARGS[4] != "") { if (ARGS[4] != "") {
const auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]); const auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]);
if (ERR != "") if (ERR != "")
parseError = ERR; parseError = ERR;
}
} }
// now, check for children, recursively // now, check for children, recursively