protect against rounding * 2 > box size

modified:   src/Window.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
This commit is contained in:
MightyPlaza 2023-10-07 13:51:34 +01:00
parent 26aabb14e3
commit 3451e31739
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
2 changed files with 9 additions and 9 deletions

View file

@ -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() {

View file

@ -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<CTitleTex>(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) {