From 3451e31739549d3f8f1c954d7c80a6a4540b5b74 Mon Sep 17 00:00:00 2001 From: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:51:34 +0100 Subject: [PATCH] protect against rounding * 2 > box size modified: src/Window.cpp modified: src/render/decorations/CHyprGroupBarDecoration.cpp --- src/Window.cpp | 10 +++++++--- src/render/decorations/CHyprGroupBarDecoration.cpp | 8 ++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 5be10f9f..b19098e8 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -930,10 +930,14 @@ int CWindow::getRealRounding() { if (!m_sSpecialRenderData.rounding) return 0; - if (m_sAdditionalConfigData.rounding.toUnderlying() != -1) - return m_sAdditionalConfigData.rounding.toUnderlying(); + int rounding; - return g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; + if (m_sAdditionalConfigData.rounding.toUnderlying() != -1) + rounding = m_sAdditionalConfigData.rounding.toUnderlying(); + else + rounding = g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; + + return std::min(rounding, (int)std::min(m_vRealSize.vec().x, m_vRealSize.vec().y) / 2); } int CWindow::getRealBorderSize() { diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 4cb78b57..f44a5133 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -107,9 +107,6 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& float currentOffset = BAR_HORIZONTAL_PADDING; - if (m_fBarWidth <= 0) - return; - // Bottom left of groupbar Vector2D pos = Vector2D( m_vLastWindowPos.x - pMonitor->vecPosition.x + offset.x + ROUNDING, @@ -184,13 +181,12 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& g_pHyprOpenGL->renderRect(&barBox, color, std::sqrt(m_iBarHeight) / 2); // render title if necessary - if (*PRENDERTITLES) { + if (*PRENDERTITLES && textBox.width > 0 && textBox.height > 0) { CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i]->m_szTitle); if (!pTitleTex) pTitleTex = m_sTitleTexs.titleTexs.emplace_back(std::make_unique(m_dwGroupMembers[i], Vector2D(textBox.width, textBox.height))).get(); - if (textBox.width > 0 && textBox.height > 0) - g_pHyprOpenGL->renderTexture(pTitleTex->tex, &textBox, 1.f); + g_pHyprOpenGL->renderTexture(pTitleTex->tex, &textBox, 1.f); } if (gradBox.width > 0 && gradBox.height > 0) {