hyprbars: fix dynamic updates of height

This commit is contained in:
Vaxry 2023-10-29 22:57:55 +00:00
parent f46771dd4f
commit f203d69f98
2 changed files with 18 additions and 4 deletions

View file

@ -345,12 +345,17 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
static auto* const PCOLOR = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_color")->intValue;
static auto* const PHEIGHT = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->intValue;
const auto BORDERSIZE = m_pWindow->getRealBorderSize();
if (*PHEIGHT < 1) {
m_iLastHeight = *PHEIGHT;
return;
}
const auto scaledRounding = *PROUNDING * pMonitor->scale;
const auto scaledBorderSize = BORDERSIZE * pMonitor->scale;
const auto BORDERSIZE = m_pWindow->getRealBorderSize();
CColor color = *PCOLOR;
const auto scaledRounding = *PROUNDING * pMonitor->scale;
const auto scaledBorderSize = BORDERSIZE * pMonitor->scale;
CColor color = *PCOLOR;
color.a *= a;
const auto ROUNDING = !m_pWindow->m_sSpecialRenderData.rounding ?
@ -423,6 +428,12 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
renderBarButtonsText(&textBox, pMonitor->scale);
m_bWindowSizeChanged = false;
// dynamic updates change the extents
if (m_iLastHeight != *PHEIGHT) {
g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_pWindow);
m_iLastHeight = *PHEIGHT;
}
}
eDecorationType CHyprBar::getDecorationType() {

View file

@ -57,4 +57,7 @@ class CHyprBar : public IHyprWindowDecoration {
bool m_bDraggingThis = false;
bool m_bDragPending = false;
bool m_bCancelledDown = false;
// for dynamic updates
int m_iLastHeight = 0;
};