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

View file

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