From b5f5c26be3074a16556c2b7982029fbfcf502b16 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 28 Dec 2022 15:18:23 +0100 Subject: [PATCH] added dim_special --- src/config/ConfigManager.cpp | 1 + src/render/Renderer.cpp | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 190283a7..dbcede2e 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -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; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 466cee46..c1d5e155 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -374,7 +374,8 @@ void CHyprRenderer::renderIMEPopup(SIMEPopup* pPopup, CMonitor* pMonitor, timesp } void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) { - const auto PMONITOR = g_pCompositor->getMonitorFromID(ID); + 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); }