From 3343aac6bf6aa601cb882859edf63a6cb59bb774 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 26 Mar 2023 02:00:24 +0100 Subject: [PATCH] feat: add forcergbx rule --- src/Window.cpp | 3 +++ src/Window.hpp | 1 + src/config/ConfigManager.cpp | 2 +- src/debug/HyprCtl.cpp | 2 ++ src/render/OpenGL.cpp | 5 ++++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 840944d4..b8c7ab36 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -406,6 +406,8 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { m_sAdditionalConfigData.forceNoBorder = true; } else if (r.szRule == "noshadow") { m_sAdditionalConfigData.forceNoShadow = true; + } else if (r.szRule == "forcergbx") { + m_sAdditionalConfigData.forceRGBX = true; } else if (r.szRule == "opaque") { if (!m_sAdditionalConfigData.forceOpaqueOverriden) m_sAdditionalConfigData.forceOpaque = true; @@ -470,6 +472,7 @@ void CWindow::updateDynamicRules() { m_sAdditionalConfigData.animationStyle = std::string(""); m_sAdditionalConfigData.rounding = -1; m_sAdditionalConfigData.dimAround = false; + m_sAdditionalConfigData.forceRGBX = false; const auto WINDOWRULES = g_pConfigManager->getMatchingRules(this); for (auto& r : WINDOWRULES) { diff --git a/src/Window.hpp b/src/Window.hpp index 6cada8c8..e4cff0aa 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -119,6 +119,7 @@ struct SWindowAdditionalConfigData { CWindowOverridableVar windowDanceCompat = false; CWindowOverridableVar noMaxSize = false; CWindowOverridableVar dimAround = false; + CWindowOverridableVar forceRGBX = false; }; struct SWindowRule { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index c6a3abd1..2283b61c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -780,7 +780,7 @@ bool windowRuleValid(const std::string& RULE) { RULE.find("maxsize") != 0 && RULE.find("pseudo") != 0 && RULE.find("monitor") != 0 && RULE.find("idleinhibit") != 0 && RULE != "nofocus" && RULE != "noblur" && RULE != "noshadow" && RULE != "noborder" && RULE != "center" && RULE != "opaque" && RULE != "forceinput" && RULE != "fullscreen" && RULE != "nofullscreenrequest" && RULE != "nomaxsize" && RULE != "pin" && RULE != "noanim" && RULE != "dimaround" && RULE != "windowdance" && RULE != "maximize" && RULE.find("animation") != 0 && - RULE.find("rounding") != 0 && RULE.find("workspace") != 0 && RULE.find("bordercolor") != 0); + RULE.find("rounding") != 0 && RULE.find("workspace") != 0 && RULE.find("bordercolor") != 0 && RULE != "forcergbx"); } bool layerRuleValid(const std::string& RULE) { diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index c9b8a25d..345a5288 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -960,6 +960,8 @@ std::string dispatchSetProp(std::string request) { PWINDOW->m_sSpecialRenderData.activeBorderColor.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else if (PROP == "inactivebordercolor") { PWINDOW->m_sSpecialRenderData.inactiveBorderColor.forceSetIgnoreLocked(configStringToInt(VAL), lock); + } else if (PROP == "forcergbx") { + PWINDOW->m_sAdditionalConfigData.forceRGBX.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else { return "prop not found"; } diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 420872e1..10ab3687 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -521,6 +521,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b } } + if (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX) + shader = &m_RenderData.pCurrentMonData->m_shRGBX; + glActiveTexture(GL_TEXTURE0); glBindTexture(tex.m_iTarget, tex.m_iTexID); @@ -875,7 +878,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, return; if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) || - (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur)) { + (m_pCurrentWindow && (m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur || m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX))) { renderTexture(tex, pBox, a, round, false, true); return; }