summaryrefslogtreecommitdiff
path: root/src/managers/AnimationManager.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2022-08-07 19:28:46 +0200
committervaxerski <vaxry@vaxry.net>2022-08-07 19:28:46 +0200
commit3a8dcf284aa3953585e3f700afa1095903c3a65f (patch)
tree9a80dd5058ae27457abf43c080cf4d0ab6d98695 /src/managers/AnimationManager.cpp
parent1744be7bdd942e0cbd5ad1b1d4426b0b9023208a (diff)
add more errors
Diffstat (limited to 'src/managers/AnimationManager.cpp')
-rw-r--r--src/managers/AnimationManager.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index 052daff8..640b462c 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -257,6 +257,15 @@ bool CAnimationManager::deltazero(const CColor& a, const CColor& b) {
return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
}
+bool CAnimationManager::bezierExists(const std::string& bezier) {
+ for (auto&[bc, bz] : m_mBezierCurves) {
+ if (bc == bezier)
+ return true;
+ }
+
+ return false;
+}
+
//
// Anims
//
@@ -393,4 +402,38 @@ void CAnimationManager::onWindowPostCreateClose(CWindow* pWindow, bool close) {
animationPopin(pWindow, close, minPerc / 100.f);
}
}
+}
+
+std::string CAnimationManager::styleValidInConfigVar(const std::string& config, const std::string& style) {
+ if (config.find("window") == 0) {
+ if (style == "slide") {
+ return "";
+ } else if (style.find("popin") == 0) {
+ // try parsing
+ float minPerc = 0.f;
+ if (style.find("%") != 0) {
+ try {
+ auto percstr = style.substr(style.find_last_of(' '));
+ minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
+ } catch (std::exception& e) {
+ return "invalid minperc";
+ }
+
+ return "";
+ }
+
+ return "";
+ }
+
+ return "unknown style";
+ } else if (config == "workspaces") {
+ if (style == "slide" || style == "slidevert" || style == "fade")
+ return "";
+
+ return "unknown style";
+ } else {
+ return "animation has no styles";
+ }
+
+ return "";
} \ No newline at end of file