2022-05-14 17:23:46 +02:00
|
|
|
#include "WLClasses.hpp"
|
|
|
|
#include "../config/ConfigManager.hpp"
|
|
|
|
|
|
|
|
SLayerSurface::SLayerSurface() {
|
2022-07-28 13:28:43 +02:00
|
|
|
alpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), nullptr, AVARDAMAGE_ENTIRE);
|
2022-05-14 17:23:46 +02:00
|
|
|
alpha.m_pLayer = this;
|
2022-11-04 16:56:31 +01:00
|
|
|
alpha.registerVar();
|
2023-03-18 00:16:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void SLayerSurface::applyRules() {
|
2023-06-11 19:30:31 +02:00
|
|
|
noAnimations = false;
|
|
|
|
forceBlur = false;
|
|
|
|
ignoreAlpha = false;
|
|
|
|
ignoreAlphaValue = 0.f;
|
2023-03-18 00:16:13 +01:00
|
|
|
|
|
|
|
for (auto& rule : g_pConfigManager->getMatchingRules(this)) {
|
|
|
|
if (rule.rule == "noanim")
|
|
|
|
noAnimations = true;
|
|
|
|
else if (rule.rule == "blur")
|
|
|
|
forceBlur = true;
|
2023-06-11 19:30:31 +02:00
|
|
|
else if (rule.rule.find("ignorealpha") == 0 || rule.rule.find("ignorezero") == 0) {
|
|
|
|
const auto FIRST_SPACE_POS = rule.rule.find_first_of(' ');
|
|
|
|
std::string alphaValue = "";
|
|
|
|
if (FIRST_SPACE_POS != std::string::npos)
|
|
|
|
alphaValue = rule.rule.substr(FIRST_SPACE_POS + 1);
|
|
|
|
|
|
|
|
try {
|
|
|
|
ignoreAlpha = true;
|
|
|
|
if (!alphaValue.empty())
|
|
|
|
ignoreAlphaValue = std::stof(alphaValue);
|
|
|
|
} catch (...) { Debug::log(ERR, "Invalid value passed to ignoreAlpha"); }
|
|
|
|
}
|
2023-03-18 00:16:13 +01:00
|
|
|
}
|
2022-05-14 17:23:46 +02:00
|
|
|
}
|