From cc04b52ce1f056817df5a1395ebc65fed7b9161f Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 11 Nov 2023 14:52:27 +0000 Subject: [PATCH] deco-positioner: recalc after uncache --- src/render/decorations/DecorationPositioner.cpp | 3 +++ src/render/decorations/DecorationPositioner.hpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index 5a8a4275..98627d4c 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -52,6 +52,7 @@ Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, CWindow* pWi void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) { std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pDecoration == deco; }); + m_mWindowDatas[deco->m_pWindow].needsRecalc = true; } void CDecorationPositioner::repositionDeco(IHyprWindowDecoration* deco) { @@ -88,10 +89,12 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) { && std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [pWindow](const auto& data) { return pWindow != data->pWindow || !data->needsReposition; }) /* all window datas are either not for this window or don't need a reposition */ + && !WINDOWDATA->needsRecalc /* window doesn't need recalc */ ) return; WINDOWDATA->lastWindowSize = pWindow->m_vRealSize.vec(); + WINDOWDATA->needsRecalc = false; const bool EPHEMERAL = pWindow->m_vRealSize.isBeingAnimated(); std::sort(datas.begin(), datas.end(), [](const auto& a, const auto& b) { return a->positioningInfo.priority > b->positioningInfo.priority; }); diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp index c85bc217..9fc45ba3 100644 --- a/src/render/decorations/DecorationPositioner.hpp +++ b/src/render/decorations/DecorationPositioner.hpp @@ -84,6 +84,7 @@ class CDecorationPositioner { Vector2D lastWindowSize = {}; SWindowDecorationExtents reserved = {}; SWindowDecorationExtents extents = {}; + bool needsRecalc = false; }; std::unordered_map m_mWindowDatas;