Skip to content

Commit

Permalink
hyprbars: verify windowBox size
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Mar 23, 2024
1 parent 81460bd commit 826d47b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hyprbars/barDeco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down

0 comments on commit 826d47b

Please sign in to comment.