diff --git a/src/Window.cpp b/src/Window.cpp index f48d27f1..63c5a79e 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -22,7 +22,10 @@ CWindow::~CWindow() { } } -wlr_box CWindow::getFullWindowBoundingBox() { +SWindowDecorationExtents CWindow::getFullWindowExtents() { + if (m_bFadingOut) + return m_eOriginalClosedExtents; + static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); @@ -37,7 +40,8 @@ wlr_box CWindow::getFullWindowBoundingBox() { if (m_sAdditionalConfigData.dimAround) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); - return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; + return {{m_vRealPosition.vec().x - PMONITOR->vecPosition.x, m_vRealPosition.vec().y - PMONITOR->vecPosition.y}, + {PMONITOR->vecSize.x - (m_vRealPosition.vec().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition.vec().y - PMONITOR->vecPosition.y)}}; } SWindowDecorationExtents maxExtents = {{borderSize + 2, borderSize + 2}, {borderSize + 2, borderSize + 2}}; @@ -90,7 +94,17 @@ wlr_box CWindow::getFullWindowBoundingBox() { maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_pWLSurface.wlr()->current.height; } - // Add extents to the real base BB and return + return maxExtents; +} + +wlr_box CWindow::getFullWindowBoundingBox() { + if (m_sAdditionalConfigData.dimAround) { + const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); + return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; + } + + auto maxExtents = getFullWindowExtents(); + wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y, m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; diff --git a/src/Window.hpp b/src/Window.hpp index d3c34a63..3ff9f6f7 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -241,11 +241,12 @@ class CWindow { CAnimatedVariable m_fBorderAngleAnimationProgress; // Fade in-out - CAnimatedVariable m_fAlpha; - bool m_bFadingOut = false; - bool m_bReadyToDelete = false; - Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in - Vector2D m_vOriginalClosedSize; // drawing the closing animations + CAnimatedVariable m_fAlpha; + bool m_bFadingOut = false; + bool m_bReadyToDelete = false; + Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in + Vector2D m_vOriginalClosedSize; // drawing the closing animations + SWindowDecorationExtents m_eOriginalClosedExtents; // For pinned (sticky) windows bool m_bPinned = false; @@ -307,6 +308,7 @@ class CWindow { // methods wlr_box getFullWindowBoundingBox(); + SWindowDecorationExtents getFullWindowExtents(); wlr_box getWindowInputBox(); wlr_box getWindowIdealBoundingBoxIgnoreReserved(); void updateWindowDecos(); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 4c901356..e79f1e74 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -650,8 +650,14 @@ void Events::listener_unmapWindow(void* owner, void* data) { PWINDOW->hyprListener_requestMinimize.removeCallback(); } - if (PWINDOW->m_bIsFullscreen) { + if (PWINDOW->m_bIsFullscreen) g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL); + + const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); + if (PMONITOR) { + PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.vec() - PMONITOR->vecPosition; + PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize.vec(); + PWINDOW->m_eOriginalClosedExtents = PWINDOW->getFullWindowExtents(); } // Allow the renderer to catch the last frame. @@ -716,14 +722,6 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)); - const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); - - // do the animation thing - if (PMONITOR) { - PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.vec() - PMONITOR->vecPosition; - PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize.vec(); - } - if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in. PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it