mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-12 18:45:44 -07:00
groupbar: fix groupbar missing when indicator_height is <= 0
ref #9291 #9372
This commit is contained in:
@@ -100,6 +100,10 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
int barsToDraw = m_dwGroupMembers.size();
|
||||
|
||||
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
|
||||
|
||||
if (!*PENABLED || !m_pWindow->m_sWindowData.decorate.valueOrDefault())
|
||||
return;
|
||||
|
||||
static auto PRENDERTITLES = CConfigValue<Hyprlang::INT>("group:groupbar:render_titles");
|
||||
static auto PTITLEFONTSIZE = CConfigValue<Hyprlang::INT>("group:groupbar:font_size");
|
||||
static auto PHEIGHT = CConfigValue<Hyprlang::INT>("group:groupbar:height");
|
||||
@@ -110,9 +114,14 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
static auto PGRADIENTROUNDING = CConfigValue<Hyprlang::INT>("group:groupbar:gradient_rounding");
|
||||
static auto PGRADIENTROUNDINGONLYEDGES = CConfigValue<Hyprlang::INT>("group:groupbar:gradient_round_only_edges");
|
||||
static auto PROUNDONLYEDGES = CConfigValue<Hyprlang::INT>("group:groupbar:round_only_edges");
|
||||
|
||||
if (!*PENABLED || !m_pWindow->m_sWindowData.decorate.valueOrDefault())
|
||||
return;
|
||||
static auto PGROUPCOLACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.active");
|
||||
static auto PGROUPCOLINACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.inactive");
|
||||
static auto PGROUPCOLACTIVELOCKED = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.locked_active");
|
||||
static auto PGROUPCOLINACTIVELOCKED = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.locked_inactive");
|
||||
auto* const GROUPCOLACTIVE = (CGradientValueData*)(PGROUPCOLACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVE = (CGradientValueData*)(PGROUPCOLINACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(PGROUPCOLACTIVELOCKED.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(PGROUPCOLINACTIVELOCKED.ptr())->getData();
|
||||
|
||||
const auto ASSIGNEDBOX = assignedBoxGlobal();
|
||||
|
||||
@@ -134,26 +143,16 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - BAR_PADDING_OUTER_VERT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y,
|
||||
m_fBarWidth, *PINDICATORHEIGHT};
|
||||
|
||||
if (rect.width <= 0 || rect.height <= 0)
|
||||
break;
|
||||
|
||||
rect.scale(pMonitor->scale);
|
||||
|
||||
static auto PGROUPCOLACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.active");
|
||||
static auto PGROUPCOLINACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.inactive");
|
||||
static auto PGROUPCOLACTIVELOCKED = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.locked_active");
|
||||
static auto PGROUPCOLINACTIVELOCKED = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.locked_inactive");
|
||||
auto* const GROUPCOLACTIVE = (CGradientValueData*)(PGROUPCOLACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVE = (CGradientValueData*)(PGROUPCOLINACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(PGROUPCOLACTIVELOCKED.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(PGROUPCOLINACTIVELOCKED.ptr())->getData();
|
||||
|
||||
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked || g_pKeybindManager->m_bGroupsLocked;
|
||||
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
|
||||
const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
|
||||
|
||||
CHyprColor color = m_dwGroupMembers[WINDOWINDEX].lock() == g_pCompositor->m_pLastWindow.lock() ? PCOLACTIVE->m_vColors[0] : PCOLINACTIVE->m_vColors[0];
|
||||
color.a *= a;
|
||||
|
||||
if (!rect.empty()) {
|
||||
CRectPassElement::SRectData rectdata;
|
||||
rectdata.color = color;
|
||||
rectdata.box = rect;
|
||||
@@ -182,12 +181,14 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
rectdata.round = *PROUNDING;
|
||||
}
|
||||
g_pHyprRenderer->m_sRenderPass.add(makeShared<CRectPassElement>(rectdata));
|
||||
}
|
||||
|
||||
rect = {ASSIGNEDBOX.x + floor(xoff) - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x,
|
||||
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth,
|
||||
(*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0)};
|
||||
rect.scale(pMonitor->scale);
|
||||
|
||||
if (!rect.empty()) {
|
||||
if (*PGRADIENTS) {
|
||||
const auto GRADIENTTEX = (m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_pLastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
|
||||
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
|
||||
@@ -217,7 +218,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
|
||||
}
|
||||
} else
|
||||
rectdata.round = *PGRADIENTROUNDING;
|
||||
data.round = *PGRADIENTROUNDING;
|
||||
}
|
||||
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
|
||||
}
|
||||
@@ -235,7 +236,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
rect.y += std::ceil((rect.height - pTitleTex->texSize.y) / 2.0);
|
||||
rect.height = pTitleTex->texSize.y;
|
||||
rect.width = pTitleTex->texSize.x;
|
||||
rect.x += std::round((m_fBarWidth * pMonitor->scale) / 2.0 - (pTitleTex->texSize.x / 2.0));
|
||||
rect.x += std::round(((m_fBarWidth * pMonitor->scale) / 2.0) - (pTitleTex->texSize.x / 2.0));
|
||||
rect.round();
|
||||
|
||||
CTexPassElement::SRenderData data;
|
||||
@@ -243,6 +244,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||
data.box = rect;
|
||||
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
|
||||
}
|
||||
}
|
||||
|
||||
if (*PSTACKED)
|
||||
yoff += ONEBARHEIGHT;
|
||||
|
Reference in New Issue
Block a user