From 739598717bbff79aad8599dcd0ca7a423682482a Mon Sep 17 00:00:00 2001 From: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> Date: Sat, 12 Aug 2023 21:37:55 +0000 Subject: [PATCH] remove shadow no_gaps_when_only (#2956) modified: src/Window.hpp modified: src/config/ConfigManager.cpp modified: src/config/ConfigManager.hpp modified: src/layout/DwindleLayout.cpp modified: src/render/decorations/CHyprDropShadowDecoration.cpp --- src/Window.hpp | 1 + src/config/ConfigManager.cpp | 2 ++ src/config/ConfigManager.hpp | 1 + src/layout/DwindleLayout.cpp | 2 ++ src/render/decorations/CHyprDropShadowDecoration.cpp | 3 +++ 5 files changed, 9 insertions(+) diff --git a/src/Window.hpp b/src/Window.hpp index 3d1c69ac..0a71305a 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -104,6 +104,7 @@ struct SWindowSpecialRenderData { bool rounding = true; bool border = true; bool decorate = true; + bool shadow = true; }; struct SWindowAdditionalConfigData { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index bb582039..6f2558bb 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1144,6 +1144,8 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: wsRule.borderSize = std::stoi(rule.substr(delim + 11)); else if ((delim = rule.find("border:")) != std::string::npos) wsRule.border = configStringToInt(rule.substr(delim + 7)); + else if ((delim = rule.find("shadow:")) != std::string::npos) + wsRule.shadow= configStringToInt(rule.substr(delim + 7)); else if ((delim = rule.find("rounding:")) != std::string::npos) wsRule.rounding = configStringToInt(rule.substr(delim + 9)); else if ((delim = rule.find("decorate:")) != std::string::npos) diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index b2b9c38c..a14f5470 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -48,6 +48,7 @@ struct SWorkspaceRule { std::optional border; std::optional rounding; std::optional decorate; + std::optional shadow; }; struct SMonitorAdditionalReservedArea { diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index cbf1cb99..4e237f30 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -150,6 +150,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for (NODESONWORKSPACE == 1 || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { PWINDOW->m_sSpecialRenderData.rounding = false; + PWINDOW->m_sSpecialRenderData.shadow = false; PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); @@ -167,6 +168,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for PWINDOW->m_sSpecialRenderData.rounding = WORKSPACERULE.rounding.value_or(true); PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); + PWINDOW->m_sSpecialRenderData.shadow = WORKSPACERULE.shadow.value_or(true); PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(true); PWINDOW->m_sSpecialRenderData.borderSize = WORKSPACERULE.borderSize.value_or(-1); diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 62e07e14..15f993c9 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -59,6 +59,9 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D if (!m_pWindow->m_sSpecialRenderData.decorate) return; + if (!m_pWindow->m_sSpecialRenderData.shadow) + return; + if (m_pWindow->m_sAdditionalConfigData.forceNoShadow) return;