summaryrefslogtreecommitdiff
path: root/src/events/Windows.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-31 17:35:50 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-31 17:35:50 +0200
commit8de7cc5a8da13973b347d5da96de89efc3dbdbaf (patch)
tree2f3120a1e870ed155d23746be0b20557bcd154aa /src/events/Windows.cpp
parente73df80782593f0cab39a5f3e7a5a005203c9b0c (diff)
opacity windowrule support 2 values
Diffstat (limited to 'src/events/Windows.cpp')
-rw-r--r--src/events/Windows.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 0fbb7227..47cb5b24 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -114,7 +114,15 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
} else if (r.szRule.find("opacity") == 0) {
try {
- PWINDOW->m_sSpecialRenderData.alpha = std::stof(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
+ std::string alphaPart = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
+
+ if (alphaPart.find_first_of(' ') != std::string::npos) {
+ // we have a comma, 2 values
+ PWINDOW->m_sSpecialRenderData.alpha = std::stof(alphaPart.substr(0, alphaPart.find_first_of(' ')));
+ PWINDOW->m_sSpecialRenderData.alphaInactive = std::stof(alphaPart.substr(alphaPart.find_first_of(' ') + 1));
+ } else {
+ PWINDOW->m_sSpecialRenderData.alpha = std::stof(alphaPart);
+ }
} catch(std::exception& e) {
Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
}