diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-12-11 17:15:02 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-12-11 17:15:02 +0000 |
| commit | e8b99ae13a0525f9fbd6899fe39fe723879f86b9 (patch) | |
| tree | 7a1f7863cc101a3076d970ab3f6e489a794e2041 /src/Window.cpp | |
| parent | bb99f151da78fea9c16644ffcc3186427320aac1 (diff) | |
add override to opacity rules
Diffstat (limited to 'src/Window.cpp')
| -rw-r--r-- | src/Window.cpp | 25 |
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()); |
