summaryrefslogtreecommitdiff
path: root/src/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cpp')
-rw-r--r--src/Window.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index 274c3d57..61711415 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -328,14 +328,23 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
}
} else if (r.szRule.find("opacity") == 0) {
try {
- std::string alphaPart = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
-
- if (alphaPart.contains(' ')) {
- // we have a space, 2 values
- m_sSpecialRenderData.alpha = std::stof(alphaPart.substr(0, alphaPart.find_first_of(' ')));
- m_sSpecialRenderData.alphaInactive = std::stof(alphaPart.substr(alphaPart.find_first_of(' ') + 1));
- } else {
- m_sSpecialRenderData.alpha = std::stof(alphaPart);
+ CVarList vars(r.szRule, 0, ' ');
+
+ for (size_t i = 1 /* first item is "opacity" */; i < vars.size(); ++i) {
+ if (i == 1) {
+ // first arg, alpha
+ m_sSpecialRenderData.alpha = std::stof(vars[i]);
+ } else {
+ if (vars[i] == "override") {
+ if (i == 2) {
+ m_sSpecialRenderData.alphaOverride = true;
+ } else {
+ m_sSpecialRenderData.alphaInactiveOverride = true;
+ }
+ } else {
+ m_sSpecialRenderData.alphaInactive = std::stof(vars[i]);
+ }
+ }
}
} catch(std::exception& e) {
Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());