check for render boxes

modified:   src/render/decorations/CHyprGroupBarDecoration.cpp

Signed-off-by: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com>
This commit is contained in:
MightyPlaza 2023-09-13 01:20:21 +01:00
parent af442d28cf
commit a58b9cf578
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D

View file

@ -89,7 +89,6 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
const auto* const PCOLACTIVE = GROUPLOCKED ? PGROUPCOLACTIVELOCKED : PGROUPCOLACTIVE; const auto* const PCOLACTIVE = GROUPLOCKED ? PGROUPCOLACTIVELOCKED : PGROUPCOLACTIVE;
const auto* const PCOLINACTIVE = GROUPLOCKED ? PGROUPCOLINACTIVELOCKED : PGROUPCOLINACTIVE; const auto* const PCOLINACTIVE = GROUPLOCKED ? PGROUPCOLINACTIVELOCKED : PGROUPCOLINACTIVE;
// TODO: fix mouse event with rounding
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
const int ROUNDING = m_pWindow->getRealRounding(); const int ROUNDING = m_pWindow->getRealRounding();
const int BORDERSIZE = m_pWindow->getRealBorderSize(); const int BORDERSIZE = m_pWindow->getRealBorderSize();
@ -98,7 +97,6 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
float currentOffset = m_bInternalBar ? BAR_HORIZONTAL_PADDING : 0; float currentOffset = m_bInternalBar ? BAR_HORIZONTAL_PADDING : 0;
// TODO: check for invalid config
if (BARW <= 0) if (BARW <= 0)
return; return;
@ -172,6 +170,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
CColor color = CColor color =
m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? ((CGradientValueData*)PCOLACTIVE->get())->m_vColors[0] : ((CGradientValueData*)PCOLINACTIVE->get())->m_vColors[0]; m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? ((CGradientValueData*)PCOLACTIVE->get())->m_vColors[0] : ((CGradientValueData*)PCOLINACTIVE->get())->m_vColors[0];
color.a *= a; color.a *= a;
if (barBox.width > 0 && barBox.height > 0)
g_pHyprOpenGL->renderRect(&barBox, color, std::sqrt(m_iBarHeight) / 2); g_pHyprOpenGL->renderRect(&barBox, color, std::sqrt(m_iBarHeight) / 2);
// render title if necessary // render title if necessary
@ -179,10 +178,12 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i]->m_szTitle); CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i]->m_szTitle);
if (!pTitleTex) if (!pTitleTex)
pTitleTex = m_sTitleTexs.titleTexs.emplace_back(std::make_unique<CTitleTex>(m_dwGroupMembers[i], Vector2D(textBox.width, textBox.height))).get(); 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 (m_iGradientHeight != 0) { if (gradBox.width > 0 && gradBox.height > 0) {
if (m_tGradientActive.m_iTexID == 0) // no idea why it doesn't work if (m_tGradientActive.m_iTexID == 0) // no idea why it doesn't work
refreshGradients(); refreshGradients();
@ -349,7 +350,7 @@ void CHyprGroupBarDecoration::forceReload(CWindow* pWindow) {
static auto* const PINTERNALBAR = &g_pConfigManager->getConfigValuePtr("group:groupbar:internal_bar")->intValue; static auto* const PINTERNALBAR = &g_pConfigManager->getConfigValuePtr("group:groupbar:internal_bar")->intValue;
m_bEnabled = *PENABLED; m_bEnabled = *PENABLED;
m_iBarInternalHeight = *PHEIGHT + (*PMODE == 1 ? BAR_INDICATOR_HEIGHT + BAR_INTERNAL_PADDING : 0); m_iBarInternalHeight = std::max((long int)0, *PHEIGHT) + (*PMODE == 1 ? BAR_INDICATOR_HEIGHT + BAR_INTERNAL_PADDING : 0);
m_iBarFullHeight = m_iBarInternalHeight + BAR_INTERNAL_PADDING + BAR_EXTERNAL_PADDING; m_iBarFullHeight = m_iBarInternalHeight + BAR_INTERNAL_PADDING + BAR_EXTERNAL_PADDING;
m_bOnTop = g_pConfigManager->getConfigValuePtr("group:groupbar:top")->intValue; m_bOnTop = g_pConfigManager->getConfigValuePtr("group:groupbar:top")->intValue;