From ca2d2db0efd7e9cbbc61321c591b732c851db61a Mon Sep 17 00:00:00 2001 From: Kainoa Kanter <44733677+ThatOneCalculator@users.noreply.github.com> Date: Thu, 20 Oct 2022 12:36:27 -0700 Subject: Add windowrules for noblur and noshadow (#884) --- src/Window.hpp | 2 ++ src/config/ConfigManager.cpp | 2 ++ src/events/Windows.cpp | 4 ++++ src/render/OpenGL.cpp | 2 +- src/render/decorations/CHyprDropShadowDecoration.cpp | 3 +++ 5 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Window.hpp b/src/Window.hpp index 5b2b201f..05359cf1 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -24,6 +24,8 @@ struct SWindowAdditionalConfigData { bool forceOpaque = false; bool forceAllowsInput = false; bool forceNoAnims = false; + bool forceNoBorder = false; + bool forceNoShadow = false; }; class CWindow { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 93dc6b17..40a36eb3 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -753,6 +753,8 @@ bool windowRuleValid(const std::string& RULE) { && RULE.find("monitor") != 0 && RULE != "nofocus" && RULE != "noblur" + && RULE != "noshadow" + && RULE != "noborder" && RULE != "center" && RULE != "opaque" && RULE != "forceinput" diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index c335769c..825e24d5 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -161,6 +161,10 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_bNoFocus = true; } else if (r.szRule == "noblur") { PWINDOW->m_sAdditionalConfigData.forceNoBlur = true; + } else if (r.szRule == "noborder") { + PWINDOW->m_sAdditionalConfigData.forceNoBorder = true; + } else if (r.szRule == "noshadow") { + PWINDOW->m_sAdditionalConfigData.forceNoShadow = true; } else if (r.szRule == "fullscreen") { requestsFullscreen = true; } else if (r.szRule == "opaque") { diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index fef110d3..1f910d30 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -799,7 +799,7 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int round) { RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!"); RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!"); - if (!pixman_region32_not_empty(m_RenderData.pDamage)) + if (!pixman_region32_not_empty(m_RenderData.pDamage) || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBorder)) return; static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index baca1201..f5f14f8b 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_sAdditionalConfigData.forceNoShadow) + return; + static auto *const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; static auto *const PSHADOWSIZE = &g_pConfigManager->getConfigValuePtr("decoration:shadow_range")->intValue; static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; -- cgit v1.2.3