diff --git a/src/Window.cpp b/src/Window.cpp index 483dedf6..5be10f9f 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -6,6 +6,10 @@ CWindow::CWindow() { m_vRealPosition.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE); m_vRealSize.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE); + m_vReservedInternalTopLeft.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE); + m_vReservedInternalBottomRight.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE); + m_vReservedExternalTopLeft.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE); + m_vReservedExternalBottomRight.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE); m_fBorderFadeAnimationProgress.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("border"), (void*)this, AVARDAMAGE_BORDER); m_fBorderAngleAnimationProgress.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("borderangle"), (void*)this, AVARDAMAGE_BORDER); m_fAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), (void*)this, AVARDAMAGE_ENTIRE); @@ -50,8 +54,8 @@ SWindowDecorationExtents CWindow::getFullWindowExtents() { maxOutterExtents.bottomRight.y = std::max(maxOutterExtents.bottomRight.y, EXTENTS.bottomRight.y); } - SWindowDecorationExtents maxExtents = {m_seReservedInternal.topLeft + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.topLeft, - m_seReservedInternal.bottomRight + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.bottomRight}; + SWindowDecorationExtents maxExtents = {m_vReservedInternalTopLeft.goalv() + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.topLeft, + m_vReservedInternalBottomRight.goalv() + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.bottomRight}; if (m_pWLSurface.exists() && !m_bIsX11) { wlr_box surfaceExtents = {0, 0, 0, 0}; @@ -141,8 +145,8 @@ wlr_box CWindow::getWindowInputBox() { return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; } - SWindowDecorationExtents maxExtents = {m_seReservedInternal.topLeft + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_seReservedExternal.topLeft, - m_seReservedInternal.bottomRight + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_seReservedExternal.bottomRight}; + SWindowDecorationExtents maxExtents = {m_vReservedInternalTopLeft.goalv() + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_vReservedExternalTopLeft.goalv(), + m_vReservedInternalBottomRight.goalv() + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_vReservedExternalBottomRight.goalv()}; // Add extents to the real base BB and return wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y, @@ -153,12 +157,13 @@ wlr_box CWindow::getWindowInputBox() { SWindowDecorationExtents CWindow::getFullWindowReservedArea() { const int BORDERSIZE = getRealBorderSize(); - return {m_seReservedInternal.topLeft + m_seReservedExternal.topLeft + Vector2D(BORDERSIZE, BORDERSIZE), - m_seReservedInternal.bottomRight + m_seReservedExternal.bottomRight + Vector2D(BORDERSIZE, BORDERSIZE)}; + return {m_vReservedInternalTopLeft.goalv() + m_vReservedExternalTopLeft.goalv() + Vector2D(BORDERSIZE, BORDERSIZE), + m_vReservedInternalBottomRight.goalv() + m_vReservedExternalBottomRight.goalv() + Vector2D(BORDERSIZE, BORDERSIZE)}; } wlr_box CWindow::getWindowInternalBox() { - wlr_box internalBox = {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y}; + wlr_box internalBox = {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y}; + SWindowDecorationExtents m_seReservedInternal = {m_vReservedInternalTopLeft.goalv(), m_vReservedInternalBottomRight.goalv()}; addExtentsToBox(&internalBox, &m_seReservedInternal); return internalBox; } @@ -181,33 +186,34 @@ void CWindow::updateWindowDecos() { } // handle this better later - auto i1 = m_seReservedInternal.topLeft; - auto i2 = m_seReservedInternal.bottomRight; - auto e1 = m_seReservedExternal.topLeft; - auto e2 = m_seReservedExternal.bottomRight; + auto i1 = m_vReservedInternalTopLeft.goalv(); + auto i2 = m_vReservedInternalBottomRight.goalv(); + auto e1 = m_vReservedExternalTopLeft.goalv(); + auto e2 = m_vReservedExternalBottomRight.goalv(); // reset extents - m_seReservedInternal.topLeft = Vector2D(); - m_seReservedInternal.bottomRight = Vector2D(); - m_seReservedExternal.topLeft = Vector2D(); - m_seReservedExternal.bottomRight = Vector2D(); + m_vReservedInternalTopLeft = Vector2D(); + m_vReservedInternalBottomRight = Vector2D(); + m_vReservedExternalTopLeft = Vector2D(); + m_vReservedExternalBottomRight = Vector2D(); for (auto& wd : m_dWindowDecorations) { const auto EXTENTS = wd->getWindowDecorationExtents(); if (EXTENTS.isInternalDecoration) { - m_seReservedInternal.topLeft.x = std::max(m_seReservedInternal.topLeft.x, EXTENTS.topLeft.x); - m_seReservedInternal.topLeft.y = std::max(m_seReservedInternal.topLeft.y, EXTENTS.topLeft.y); - m_seReservedInternal.bottomRight.x = std::max(m_seReservedInternal.bottomRight.x, EXTENTS.bottomRight.x); - m_seReservedInternal.bottomRight.y = std::max(m_seReservedInternal.bottomRight.y, EXTENTS.bottomRight.y); + m_vReservedInternalTopLeft = + Vector2D(std::max(m_vReservedInternalTopLeft.goalv().x, EXTENTS.topLeft.x), std::max(m_vReservedInternalTopLeft.goalv().y, EXTENTS.topLeft.y)); + m_vReservedInternalBottomRight = + Vector2D(std::max(m_vReservedInternalBottomRight.goalv().x, EXTENTS.bottomRight.x), std::max(m_vReservedInternalBottomRight.goalv().y, EXTENTS.bottomRight.y)); } else if (EXTENTS.isReservedArea) { - m_seReservedExternal.topLeft.x = std::max(m_seReservedExternal.topLeft.x, EXTENTS.topLeft.x); - m_seReservedExternal.topLeft.y = std::max(m_seReservedExternal.topLeft.y, EXTENTS.topLeft.y); - m_seReservedExternal.bottomRight.x = std::max(m_seReservedExternal.bottomRight.x, EXTENTS.bottomRight.x); - m_seReservedExternal.bottomRight.y = std::max(m_seReservedExternal.bottomRight.y, EXTENTS.bottomRight.y); + m_vReservedExternalTopLeft = + Vector2D(std::max(m_vReservedExternalTopLeft.goalv().x, EXTENTS.topLeft.x), std::max(m_vReservedExternalTopLeft.goalv().y, EXTENTS.topLeft.y)); + m_vReservedExternalBottomRight = + Vector2D(std::max(m_vReservedExternalBottomRight.goalv().x, EXTENTS.bottomRight.x), std::max(m_vReservedExternalBottomRight.goalv().y, EXTENTS.bottomRight.y)); } } - if (i1 != m_seReservedInternal.topLeft || i2 != m_seReservedInternal.bottomRight || e1 != m_seReservedExternal.topLeft || e2 != m_seReservedExternal.bottomRight) + if (i1 != m_vReservedInternalTopLeft.goalv() || i2 != m_vReservedInternalBottomRight.goalv() || e1 != m_vReservedExternalTopLeft.goalv() || + e2 != m_vReservedExternalBottomRight.goalv()) recalc = true; if (recalc) diff --git a/src/Window.hpp b/src/Window.hpp index f11ea32a..9eec5e4a 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -286,8 +286,10 @@ class CWindow { std::vector m_vDecosToRemove; // Window decorations internal and external reserved area - SWindowDecorationExtents m_seReservedInternal; - SWindowDecorationExtents m_seReservedExternal; + CAnimatedVariable m_vReservedInternalTopLeft; + CAnimatedVariable m_vReservedInternalBottomRight; + CAnimatedVariable m_vReservedExternalTopLeft; + CAnimatedVariable m_vReservedExternalBottomRight; // Special render data, rules, etc SWindowSpecialRenderData m_sSpecialRenderData; diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 9bb82555..a21d6a24 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -148,9 +148,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.shadow = false; - PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedExternal.topLeft; - PWINDOW->m_vRealSize = PWINDOW->m_vSize - (PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedInternal.bottomRight) - - (PWINDOW->m_seReservedExternal.topLeft + PWINDOW->m_seReservedExternal.bottomRight); + PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + PWINDOW->m_vReservedInternalTopLeft.goalv() + PWINDOW->m_vReservedExternalTopLeft.goalv(); + PWINDOW->m_vRealSize = PWINDOW->m_vSize - (PWINDOW->m_vReservedInternalTopLeft.goalv() + PWINDOW->m_vReservedInternalBottomRight.goalv()) - + (PWINDOW->m_vReservedExternalTopLeft.goalv() + PWINDOW->m_vReservedExternalBottomRight.goalv()); PWINDOW->updateWindowDecos(); diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index d1795fc5..a569e630 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -630,9 +630,9 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.shadow = false; - PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedExternal.topLeft; - PWINDOW->m_vRealSize = PWINDOW->m_vSize - (PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedInternal.bottomRight) - - (PWINDOW->m_seReservedExternal.topLeft + PWINDOW->m_seReservedExternal.bottomRight); + PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + PWINDOW->m_vReservedInternalTopLeft.goalv() + PWINDOW->m_vReservedExternalTopLeft.goalv(); + PWINDOW->m_vRealSize = PWINDOW->m_vSize - (PWINDOW->m_vReservedInternalTopLeft.goalv() + PWINDOW->m_vReservedInternalBottomRight.goalv()) - + (PWINDOW->m_vReservedExternalTopLeft.goalv() + PWINDOW->m_vReservedExternalBottomRight.goalv()); PWINDOW->updateWindowDecos(); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index a15b277e..4d5dc387 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -412,10 +412,10 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* wlr_box borderBox; if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL) - borderBox = {renderdata.x - pMonitor->vecPosition.x - pWindow->m_seReservedInternal.topLeft.x, - renderdata.y - pMonitor->vecPosition.y - pWindow->m_seReservedInternal.topLeft.y, - renderdata.w + pWindow->m_seReservedInternal.topLeft.x + pWindow->m_seReservedInternal.bottomRight.x, - renderdata.h + pWindow->m_seReservedInternal.topLeft.y + pWindow->m_seReservedInternal.bottomRight.y}; + borderBox = {renderdata.x - pMonitor->vecPosition.x - pWindow->m_vReservedInternalTopLeft.goalv().x, + renderdata.y - pMonitor->vecPosition.y - pWindow->m_vReservedInternalTopLeft.goalv().y, + renderdata.w + pWindow->m_vReservedInternalTopLeft.goalv().x + pWindow->m_vReservedInternalBottomRight.goalv().x, + renderdata.h + pWindow->m_vReservedInternalTopLeft.goalv().y + pWindow->m_vReservedInternalBottomRight.goalv().y}; else borderBox = windowBox; diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 1c2d33bc..5f226c55 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -77,11 +77,12 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D if (*PSHADOWS != 1) return; // disabled - const auto ROUNDING = m_pWindow->getRealRounding(); - const auto BORDERSIZE = m_pWindow->getRealBorderSize(); + const auto ROUNDING = m_pWindow->getRealRounding(); + const auto BORDERSIZE = m_pWindow->getRealBorderSize(); - wlr_box windowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y}; - addExtentsToBox(&windowBox, &m_pWindow->m_seReservedInternal); + wlr_box windowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y}; + SWindowDecorationExtents m_seReservedInternal = {m_pWindow->m_vReservedInternalTopLeft.goalv(), m_pWindow->m_vReservedInternalBottomRight.goalv()}; + addExtentsToBox(&windowBox, &m_seReservedInternal); windowBox.x -= pMonitor->vecPosition.x + BORDERSIZE; windowBox.y -= pMonitor->vecPosition.y + BORDERSIZE;