mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-24 11:15:58 +01:00
hyprbars: fix dynamic updates of height
This commit is contained in:
parent
f46771dd4f
commit
f203d69f98
2 changed files with 18 additions and 4 deletions
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue