From 9099c480d84563f3e86548b8f9a4494fd2b11bd1 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 11 Dec 2023 16:46:45 +0000 Subject: [PATCH] hyprbars: exclude rounding from geometry calcs --- hyprbars/barDeco.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 62872c1..74ae468 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -361,11 +361,9 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID); const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D(); - const auto BORDERSIZE = m_pWindow->getRealBorderSize(); - const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize(); + const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize(); - const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0; - const int scaledBorderSize = BORDERSIZE * pMonitor->scale; + const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0; CColor color = *PCOLOR; color.a *= a; @@ -377,7 +375,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { const auto BARBUF = DECOBOX.size() * pMonitor->scale; CBox titleBarBox = {DECOBOX.x - pMonitor->vecPosition.x, DECOBOX.y - pMonitor->vecPosition.y, DECOBOX.w, - DECOBOX.h + ROUNDING * 3 /* to fill the bottom cuz we can't disable rounding there */}; + DECOBOX.h + ROUNDING * 3 /* to fill the bottom cuz we can't disable rounding there */}; titleBarBox.translate(offset).scale(pMonitor->scale).round(); @@ -397,9 +395,8 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { 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.vec().x + offset.x - pMonitor->vecPosition.x - BORDERSIZE + 1, - m_pWindow->m_vRealPosition.vec().y + offset.y - pMonitor->vecPosition.y - BORDERSIZE + 1, m_pWindow->m_vRealSize.vec().x + 2 * BORDERSIZE - 2, - m_pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE - 2}; + CBox windowBox = {m_pWindow->m_vRealPosition.vec().x + offset.x - pMonitor->vecPosition.x + 1, m_pWindow->m_vRealPosition.vec().y + offset.y - pMonitor->vecPosition.y + 1, + m_pWindow->m_vRealSize.vec().x - 2, m_pWindow->m_vRealSize.vec().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);