diff --git a/src/Window.cpp b/src/Window.cpp index fbd06417..3d669e70 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -72,4 +72,9 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() { } return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; +} + +void CWindow::updateWindowDecos() { + for (auto& wd : m_dWindowDecorations) + wd->updateWindow(this); } \ No newline at end of file diff --git a/src/Window.hpp b/src/Window.hpp index 2086c903..8b8cc9c8 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -111,5 +111,6 @@ public: // methods wlr_box getFullWindowBoundingBox(); wlr_box getWindowIdealBoundingBoxIgnoreReserved(); + void updateWindowDecos(); }; diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index c72dbb99..c82c6889 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -176,6 +176,8 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) { g_pXWaylandManager->setWindowSize(PWINDOW, calcSize); } + + PWINDOW->updateWindowDecos(); } void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) { @@ -514,12 +516,17 @@ void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) { if (g_pInputManager->dragButton == BTN_LEFT) { DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(m_vBeginDragPositionXY + DELTA); + + DRAGGINGWINDOW->updateWindowDecos(); + g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv()); } else { if (DRAGGINGWINDOW->m_bIsFloating) { DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(m_vBeginDragSizeXY + DELTA); DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(Vector2D(std::clamp(DRAGGINGWINDOW->m_vRealSize.vec().x, (double)20, (double)999999), std::clamp(DRAGGINGWINDOW->m_vRealSize.vec().y, (double)20, (double)999999))); + DRAGGINGWINDOW->updateWindowDecos(); + g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv()); } else { resizeActiveWindow(TICKDELTA, DRAGGINGWINDOW); @@ -551,6 +558,7 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow* if (!PNODE) { PWINDOW->m_vRealSize = Vector2D(std::clamp((PWINDOW->m_vRealSize.goalv() + pixResize).x, (double)20, (double)999999), std::clamp((PWINDOW->m_vRealSize.goalv() + pixResize).y, (double)20, (double)999999)); + PWINDOW->updateWindowDecos(); return; } diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index e8f1a1f1..61221938 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -150,8 +150,16 @@ void CAnimationManager::tick() { if (PWINDOW) { g_pHyprRenderer->damageWindow(PWINDOW); - for (auto& wd : PWINDOW->m_dWindowDecorations) { - wd->updateWindow(PWINDOW); + PWINDOW->updateWindowDecos(); + } else if (PWORKSPACE) { + for (auto& w : g_pCompositor->m_lWindows) { + if (!w.m_bIsMapped || w.m_bHidden) + continue; + + if (w.m_iWorkspaceID != PWORKSPACE->m_iID) + continue; + + w.updateWindowDecos(); } } break; diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 01bc2170..20dbbb30 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -35,6 +35,15 @@ void CHyprDropShadowDecoration::damageEntire() { void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) { damageEntire(); + + const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); + + if (pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec() != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { + m_vLastWindowPos = pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec(); + m_vLastWindowSize = pWindow->m_vRealSize.vec(); + + damageEntire(); + } } void CHyprDropShadowDecoration::draw(SMonitor* pMonitor, float a) { @@ -69,9 +78,6 @@ void CHyprDropShadowDecoration::draw(SMonitor* pMonitor, float a) { // update the extents m_seExtents = {{*PSHADOWSIZE + 2 - offset.x, *PSHADOWSIZE + 2 - offset.y}, {*PSHADOWSIZE + 2 + offset.x, *PSHADOWSIZE + 2 + offset.y}}; - m_vLastWindowPos = m_pWindow->m_vRealPosition.vec(); - m_vLastWindowSize = m_pWindow->m_vRealSize.vec(); - // draw the shadow wlr_box fullBox = {m_vLastWindowPos.x - m_seExtents.topLeft.x + 2, m_vLastWindowPos.y - m_seExtents.topLeft.y + 2, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x - 4, m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y - 4}; diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 2bb486ee..833033de 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -21,14 +21,16 @@ eDecorationType CHyprGroupBarDecoration::getDecorationType() { void CHyprGroupBarDecoration::updateWindow(CWindow* pWindow) { damageEntire(); - if (pWindow->m_vRealPosition.vec() != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { + const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); + + if (pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec() != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { // we draw 3px above the window's border with 3px const auto BORDERSIZE = g_pConfigManager->getInt("general:border_size"); m_seExtents.topLeft = Vector2D(0, BORDERSIZE + 3 + 3); m_seExtents.bottomRight = Vector2D(); - m_vLastWindowPos = pWindow->m_vRealPosition.vec(); + m_vLastWindowPos = pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec(); m_vLastWindowSize = pWindow->m_vRealSize.vec(); }