From bea828ea4585bab206b8772b838f496e0eada12e Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 11 Nov 2023 15:18:04 +0000 Subject: decoration-positioner: improve extent handling --- src/render/decorations/CHyprDropShadowDecoration.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/render/decorations/CHyprDropShadowDecoration.cpp') diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 9f051ad3..1990d37d 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -6,16 +6,20 @@ CHyprDropShadowDecoration::CHyprDropShadowDecoration(CWindow* pWindow) : IHyprWi m_pWindow = pWindow; } -CHyprDropShadowDecoration::~CHyprDropShadowDecoration() { - updateWindow(m_pWindow); -} +CHyprDropShadowDecoration::~CHyprDropShadowDecoration() {} eDecorationType CHyprDropShadowDecoration::getDecorationType() { return DECORATION_SHADOW; } SDecorationPositioningInfo CHyprDropShadowDecoration::getPositioningInfo() { - return {DECORATION_POSITION_ABSOLUTE}; + SDecorationPositioningInfo info; + info.policy = DECORATION_POSITION_ABSOLUTE; + info.desiredExtents = m_seExtents; + info.edges = DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP; + + m_seReportedExtents = m_seExtents; + return info; } void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningReply& reply) { @@ -148,8 +152,11 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D } else { g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, a); } + + if (m_seExtents != m_seReportedExtents) + g_pDecorationPositioner->repositionDeco(this); } eDecorationLayer CHyprDropShadowDecoration::getDecorationLayer() { return DECORATION_LAYER_BOTTOM; -} \ No newline at end of file +} -- cgit v1.2.3