diff options
-rw-r--r-- | src/Compositor.cpp | 6 | ||||
-rw-r--r-- | src/desktop/Window.cpp | 7 | ||||
-rw-r--r-- | src/desktop/Window.hpp | 1 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 2 |
4 files changed, 15 insertions, 1 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 5e8c8048..9bcbdb0f 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2649,6 +2649,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor const bool FULLSCREEN = pWindow->isFullscreen(); const auto FULLSCREENMODE = pWindow->m_sFullscreenState.internal; + const bool WASVISIBLE = pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible(); if (FULLSCREEN) setWindowFullscreenInternal(pWindow, FSMODE_NONE); @@ -2716,6 +2717,11 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor if (pWindow->m_pWorkspace) pWindow->m_pWorkspace->updateWindows(); g_pCompositor->updateSuspendedStates(); + + if (!WASVISIBLE && pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible()) { + pWindow->m_fMovingFromWorkspaceAlpha.setValueAndWarp(0.F); + pWindow->m_fMovingFromWorkspaceAlpha = 1.F; + } } PHLWINDOW CCompositor::getForceFocus() { diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 696bfc5b..871e73ed 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -33,6 +33,7 @@ PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) { pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW); pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE); pWindow->m_fMovingToWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE); + pWindow->m_fMovingFromWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow)); pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow)); @@ -55,6 +56,7 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) { pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW); pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE); pWindow->m_fMovingToWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE); + pWindow->m_fMovingFromWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow)); pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow)); @@ -504,6 +506,7 @@ void CWindow::onUnmap() { m_cRealShadowColor.setCallbackOnEnd(unregisterVar); m_fDimPercent.setCallbackOnEnd(unregisterVar); m_fMovingToWorkspaceAlpha.setCallbackOnEnd(unregisterVar); + m_fMovingFromWorkspaceAlpha.setCallbackOnEnd(unregisterVar); m_vRealSize.setCallbackOnBegin(nullptr); @@ -547,6 +550,7 @@ void CWindow::onMap() { m_cRealShadowColor.resetAllCallbacks(); m_fDimPercent.resetAllCallbacks(); m_fMovingToWorkspaceAlpha.resetAllCallbacks(); + m_fMovingFromWorkspaceAlpha.resetAllCallbacks(); m_vRealPosition.registerVar(); m_vRealSize.registerVar(); @@ -557,12 +561,15 @@ void CWindow::onMap() { m_cRealShadowColor.registerVar(); m_fDimPercent.registerVar(); m_fMovingToWorkspaceAlpha.registerVar(); + m_fMovingFromWorkspaceAlpha.registerVar(); m_fBorderAngleAnimationProgress.setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false); m_fBorderAngleAnimationProgress.setValueAndWarp(0.f); m_fBorderAngleAnimationProgress = 1.f; + m_fMovingFromWorkspaceAlpha.setValueAndWarp(1.F); + g_pCompositor->m_vWindowFocusHistory.push_back(m_pSelf); m_vReportedSize = m_vPendingReportedSize; diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index 7b2cfbdf..6ed9a525 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -336,6 +336,7 @@ class CWindow { // for alpha CAnimatedVariable<float> m_fActiveInactiveAlpha; + CAnimatedVariable<float> m_fMovingFromWorkspaceAlpha; // animated shadow color CAnimatedVariable<CHyprColor> m_cRealShadowColor; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 4edd5a0c..c873842b 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -597,7 +597,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe renderdata.surface = pWindow->m_pWLSurface->resource(); renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN) || pWindow->m_sWindowData.noRounding.valueOrDefault(); renderdata.fadeAlpha = pWindow->m_fAlpha.value() * (pWindow->m_bPinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_fAlpha.value()) * - (USE_WORKSPACE_FADE_ALPHA ? pWindow->m_fMovingToWorkspaceAlpha.value() : 1.F); + (USE_WORKSPACE_FADE_ALPHA ? pWindow->m_fMovingToWorkspaceAlpha.value() : 1.F) * pWindow->m_fMovingFromWorkspaceAlpha.value(); renderdata.alpha = pWindow->m_fActiveInactiveAlpha.value(); renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && !pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN); renderdata.rounding = ignoreAllGeometry || renderdata.dontRound ? 0 : pWindow->rounding() * pMonitor->scale; |