diff options
| author | levnikmyskin <ale.sleeper@gmail.com> | 2023-05-01 23:28:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-01 22:28:27 +0100 |
| commit | c949173bc9c9f9e8276cba098cb82ed51ad4965b (patch) | |
| tree | d66c874c988a1229d237fb1818957c0d68a81ab4 /src/render | |
| parent | 250d5cf78c191c51c327f6df219fba4ac3ed1a85 (diff) | |
Added some workspace-specific rules (#1986)
* added some workspace-specific rules
* added some worskpace-specific rules, with windowrule like syntax
* monitor is not mandatory anymore
* pointers to config are now static
* fixed optional WorkspaceRule fields
* Windows can now specify border size
* removed CHyprOpenGLImpl::renderBorder borderSize default value
* stuff
---------
Co-authored-by: Alessio Molinari <alessiomolinari@gmail.com>
Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/OpenGL.cpp | 6 | ||||
| -rw-r--r-- | src/render/OpenGL.hpp | 5 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 7 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index ffe4cdc0..7626d419 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1051,7 +1051,7 @@ void pushVert2D(float x, float y, float* arr, int& counter, wlr_box* box) { counter++; } -void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad, int round, float a) { +void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad, int round, int borderSize, float a) { 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()!"); @@ -1068,10 +1068,10 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad, box = &newBox; - if (*PBORDERSIZE < 1) + if (borderSize < 1) return; - int scaledBorderSize = *PBORDERSIZE * m_RenderData.pMonitor->scale * m_RenderData.renderModif.scale; + int scaledBorderSize = borderSize * m_RenderData.pMonitor->scale * m_RenderData.renderModif.scale; // adjust box box->x -= scaledBorderSize; diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 1b9c3c8d..1b61887e 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -23,8 +23,7 @@ inline const float fullVerts[] = { }; inline const float fanVertsFull[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f}; -enum eDiscardMode -{ +enum eDiscardMode { DISCARD_OPAQUE = 1, DISCARD_ALPHAZERO = 1 << 1 }; @@ -102,7 +101,7 @@ class CHyprOpenGLImpl { void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false); void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0, bool blockBlurOptimization = false); void renderRoundedShadow(wlr_box*, int round, int range, float a = 1.0); - void renderBorder(wlr_box*, const CGradientValueData&, int round, float a = 1.0); + void renderBorder(wlr_box*, const CGradientValueData&, int round, int borderSize, float a = 1.0); void saveMatrix(); void setMatrixScaleTranslate(const Vector2D& translate, const float& scale); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 62a0ac05..8b88c997 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -248,6 +248,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec()); static auto* const PNOFLOATINGBORDERS = &g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue; static auto* const PDIMAROUND = &g_pConfigManager->getConfigValuePtr("decoration:dim_around")->floatValue; + static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; SRenderData renderdata = {pMonitor, time, REALPOS.x, REALPOS.y}; if (ignorePosition) { @@ -342,11 +343,13 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* scaleBox(&windowBox, pMonitor->scale); - g_pHyprOpenGL->renderBorder(&windowBox, grad, rounding, a1); + const int BORDERSIZE = pWindow->m_sSpecialRenderData.borderSize == -1 ? *PBORDERSIZE : pWindow->m_sSpecialRenderData.borderSize; + + g_pHyprOpenGL->renderBorder(&windowBox, grad, rounding, BORDERSIZE, a1); if (ANIMATED) { float a2 = renderdata.fadeAlpha * renderdata.alpha * (1.f - g_pHyprOpenGL->m_pCurrentWindow->m_fBorderFadeAnimationProgress.fl()); - g_pHyprOpenGL->renderBorder(&windowBox, g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColorPrevious, rounding, a2); + g_pHyprOpenGL->renderBorder(&windowBox, g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColorPrevious, rounding, BORDERSIZE, a2); } } } |
