From 826d47b85566f2c928a4412adf5adc1f7b9e3773 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 23 Mar 2024 21:24:42 +0000 Subject: [PATCH] hyprbars: verify windowBox size --- hyprbars/barDeco.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index adef237..2553f52 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -423,6 +423,14 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { g_pHyprOpenGL->scissor(&titleBarBox); if (ROUNDING) { + // the +1 is a shit garbage temp fix until renderRect supports an alpha matte + CBox windowBox = {m_pWindow->m_vRealPosition.value().x + offset.x - pMonitor->vecPosition.x + 1, + m_pWindow->m_vRealPosition.value().y + offset.y - pMonitor->vecPosition.y + 1, m_pWindow->m_vRealSize.value().x - 2, + m_pWindow->m_vRealSize.value().y - 2}; + + if (windowBox.w < 1 || windowBox.h < 1) + return; + glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); @@ -432,10 +440,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - // the +1 is a shit garbage temp fix until renderRect supports an alpha matte - CBox windowBox = {m_pWindow->m_vRealPosition.value().x + offset.x - pMonitor->vecPosition.x + 1, - m_pWindow->m_vRealPosition.value().y + offset.y - pMonitor->vecPosition.y + 1, m_pWindow->m_vRealSize.value().x - 2, - m_pWindow->m_vRealSize.value().y - 2}; + windowBox.translate(WORKSPACEOFFSET).scale(pMonitor->scale).round(); g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), scaledRounding); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);