From f09de365d5214ea73e6578bd7a72e6c16740b6a0 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 16 May 2022 23:13:32 +0200 Subject: Added workspace fade transition --- src/helpers/Workspace.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/helpers/Workspace.cpp') diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index e4065907..80bf139c 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -23,6 +23,8 @@ CWorkspace::CWorkspace(int monitorID) { m_vRenderOffset.m_pWorkspace = this; m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE); + m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE); + m_fAlpha.setValueAndWarp(255.f); } CWorkspace::~CWorkspace() { @@ -33,4 +35,28 @@ CWorkspace::~CWorkspace() { wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle); m_pWlrHandle = nullptr; } +} + +void CWorkspace::startAnim(bool in, bool left) { + const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style"); + + if (ANIMSTYLE == "fade") { + if (in) { + m_fAlpha.setValueAndWarp(0.f); + m_fAlpha = 255.f; + } else { + m_fAlpha.setValueAndWarp(255.f); + m_fAlpha = 0.f; + } + } else { + // fallback is slide + const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); + + if (in) { + m_vRenderOffset.setValueAndWarp(Vector2D(left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0)); + m_vRenderOffset = Vector2D(0, 0); + } else { + m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0); + } + } } \ No newline at end of file -- cgit v1.2.3 From cc84b0ce504f3bab8e32f77a9716c64fdc30ad84 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 17 May 2022 13:24:23 +0200 Subject: fix workspace fade damage --- src/helpers/Workspace.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/helpers/Workspace.cpp') diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index 80bf139c..16037fb6 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -23,6 +23,7 @@ CWorkspace::CWorkspace(int monitorID) { m_vRenderOffset.m_pWorkspace = this; m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE); + m_fAlpha.m_pWorkspace = this; m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE); m_fAlpha.setValueAndWarp(255.f); } -- cgit v1.2.3 From ba573a529afdbf368aa632cf70b41c9a0595578b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 18 May 2022 12:39:20 +0200 Subject: fix workspaces disappearing on switch anim mode --- src/helpers/Workspace.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/helpers/Workspace.cpp') diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index 16037fb6..5341fdf7 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -42,6 +42,8 @@ void CWorkspace::startAnim(bool in, bool left) { const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style"); if (ANIMSTYLE == "fade") { + m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade. + if (in) { m_fAlpha.setValueAndWarp(0.f); m_fAlpha = 255.f; @@ -52,7 +54,9 @@ void CWorkspace::startAnim(bool in, bool left) { } else { // fallback is slide const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); - + + m_fAlpha.setValueAndWarp(255.f); // fix a bug, if switching from fade -> slide. + if (in) { m_vRenderOffset.setValueAndWarp(Vector2D(left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0)); m_vRenderOffset = Vector2D(0, 0); -- cgit v1.2.3