diff --git a/src/Window.cpp b/src/Window.cpp index c1b79c2d..770350a4 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -202,12 +202,16 @@ void CWindow::updateWindowDecos() { void CWindow::addWindowDeco(std::unique_ptr deco) { m_dWindowDecorations.emplace_back(std::move(deco)); + g_pDecorationPositioner->forceRecalcFor(this); updateWindowDecos(); + g_pLayoutManager->getCurrentLayout()->recalculateWindow(this); } void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) { m_vDecosToRemove.push_back(deco); + g_pDecorationPositioner->forceRecalcFor(this); updateWindowDecos(); + g_pLayoutManager->getCurrentLayout()->recalculateWindow(this); } pid_t CWindow::getPID() { diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index 937eaa9a..b41b92a9 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -95,6 +95,16 @@ void CDecorationPositioner::sanitizeDatas() { }); } +void CDecorationPositioner::forceRecalcFor(CWindow* pWindow) { + const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == pWindow; }); + if (WIT == m_mWindowDatas.end()) + return; + + const auto WINDOWDATA = &WIT->second; + + WINDOWDATA->needsRecalc = true; +} + void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) { if (!g_pCompositor->windowExists(pWindow) || !pWindow->m_bIsMapped) return; diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp index ae4a814a..740b4efe 100644 --- a/src/render/decorations/DecorationPositioner.hpp +++ b/src/render/decorations/DecorationPositioner.hpp @@ -71,6 +71,7 @@ class CDecorationPositioner { CBox getBoxWithIncludedDecos(CWindow* pWindow); void repositionDeco(IHyprWindowDecoration* deco); CBox getWindowDecorationBox(IHyprWindowDecoration* deco); + void forceRecalcFor(CWindow* pWindow); private: struct SWindowPositioningData {