mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-12-19 13:41:42 +03:00
opacity windowrule support 2 values
This commit is contained in:
parent
e73df80782
commit
8de7cc5a8d
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
struct SWindowSpecialRenderData {
|
struct SWindowSpecialRenderData {
|
||||||
float alpha = 1.f;
|
float alpha = 1.f;
|
||||||
|
float alphaInactive = -1.f; // -1 means unset
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SWindowAdditionalConfigData {
|
struct SWindowAdditionalConfigData {
|
||||||
|
@ -114,7 +114,15 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
} else if (r.szRule.find("opacity") == 0) {
|
} else if (r.szRule.find("opacity") == 0) {
|
||||||
try {
|
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) {
|
} catch(std::exception& e) {
|
||||||
Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
|
Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,10 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
|||||||
renderdata.rounding = pWindow->m_sAdditionalConfigData.rounding;
|
renderdata.rounding = pWindow->m_sAdditionalConfigData.rounding;
|
||||||
|
|
||||||
// apply window special data
|
// apply window special data
|
||||||
renderdata.alpha *= pWindow->m_sSpecialRenderData.alpha;
|
if (pWindow->m_sSpecialRenderData.alphaInactive == -1)
|
||||||
|
renderdata.alpha *= pWindow->m_sSpecialRenderData.alpha;
|
||||||
|
else
|
||||||
|
renderdata.alpha *= pWindow == g_pCompositor->m_pLastWindow ? pWindow->m_sSpecialRenderData.alpha : pWindow->m_sSpecialRenderData.alphaInactive;
|
||||||
|
|
||||||
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
|
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user