added dim_special

This commit is contained in:
Vaxry 2022-12-28 15:18:23 +01:00
parent d64fc7d336
commit b5f5c26be3
2 changed files with 20 additions and 1 deletions

View file

@ -92,6 +92,7 @@ void CConfigManager::setDefaultVars() {
configValues["decoration:col.shadow_inactive"].intValue = INT_MAX;
configValues["decoration:dim_inactive"].intValue = 0;
configValues["decoration:dim_strength"].floatValue = 0.5f;
configValues["decoration:dim_special"].floatValue = 0.2f;
configValues["decoration:screen_shader"].strValue = STRVAL_EMPTY;
configValues["dwindle:pseudotile"].intValue = 0;

View file

@ -375,6 +375,7 @@ void CHyprRenderer::renderIMEPopup(SIMEPopup* pPopup, CMonitor* pMonitor, timesp
void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(ID);
static auto* const PDIMSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:dim_special")->floatValue;
if (!PMONITOR)
return;
@ -483,6 +484,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
}
// and then special
bool renderedSpecialBG = false;
for (auto& w : g_pCompositor->m_vWindows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
@ -493,6 +495,22 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
if (!shouldRenderWindow(w.get(), PMONITOR))
continue;
if (!renderedSpecialBG) {
if (*PDIMSPECIAL != 0.f) {
const auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID);
const auto SPECIALANIMPROGRS =
PSPECIALWORKSPACE->m_vRenderOffset.isBeingAnimated() ? PSPECIALWORKSPACE->m_vRenderOffset.getPercent() : PSPECIALWORKSPACE->m_fAlpha.getPercent();
const bool ANIMOUT = !PMONITOR->specialWorkspaceID;
wlr_box monbox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * 255.f * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
}
renderedSpecialBG = true;
}
// render the bad boy
renderWindow(w.get(), PMONITOR, time, true, RENDER_PASS_ALL);
}