decoration-positioner: improve extent handling

This commit is contained in:
Vaxry 2023-11-11 15:18:04 +00:00
parent c5d1faf72d
commit bea828ea45
6 changed files with 60 additions and 17 deletions

View file

@ -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;
}
}