From 883463f9dd7f1cdc68c3e32017c0a71ccbe39b26 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 21 Aug 2024 14:37:50 +0200 Subject: [PATCH 16/20] animations: add workspace in/out configs --- src/config/ConfigManager.cpp | 10 +++++++++- src/desktop/Workspace.cpp | 12 ++++++++++-- src/managers/AnimationManager.cpp | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 155b75d3..e2ae2c47 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -724,7 +724,6 @@ void CConfigManager::setDefaultAnimationVars() { INITANIMCFG("fade"); INITANIMCFG("border"); INITANIMCFG("borderangle"); - INITANIMCFG("workspaces"); // windows INITANIMCFG("windowsIn"); @@ -745,7 +744,12 @@ void CConfigManager::setDefaultAnimationVars() { // border // workspaces + INITANIMCFG("workspaces"); + INITANIMCFG("workspacesIn"); + INITANIMCFG("workspacesOut"); INITANIMCFG("specialWorkspace"); + INITANIMCFG("specialWorkspaceIn"); + INITANIMCFG("specialWorkspaceOut"); } // init the values @@ -774,7 +778,11 @@ void CConfigManager::setDefaultAnimationVars() { CREATEANIMCFG("fadeLayersIn", "fadeLayers"); CREATEANIMCFG("fadeLayersOut", "fadeLayers"); + CREATEANIMCFG("workspacesIn", "workspaces"); + CREATEANIMCFG("workspacesOut", "workspaces"); CREATEANIMCFG("specialWorkspace", "workspaces"); + CREATEANIMCFG("specialWorkspaceIn", "specialWorkspace"); + CREATEANIMCFG("specialWorkspaceOut", "specialWorkspace"); } std::optional CConfigManager::resetHLConfig() { diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index d9ac7927..a9412e6d 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -22,10 +22,11 @@ CWorkspace::CWorkspace(WORKSPACEID id, MONITORID monitorID, std::string name, bo void CWorkspace::init(PHLWORKSPACE self) { m_pSelf = self; - m_vRenderOffset.create(m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"), + m_vRenderOffset.create(m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspaceIn") : + g_pConfigManager->getAnimationPropertyConfig("workspacesIn"), self, AVARDAMAGE_ENTIRE); m_fAlpha.create(AVARTYPE_FLOAT, - m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"), self, + m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspaceIn") : g_pConfigManager->getAnimationPropertyConfig("workspacesIn"), self, AVARDAMAGE_ENTIRE); m_fAlpha.setValueAndWarp(1.f); @@ -81,6 +82,13 @@ CWorkspace::~CWorkspace() { } void CWorkspace::startAnim(bool in, bool left, bool instant) { + if (!instant) { + const std::string ANIMNAME = std::format("{}{}", m_bIsSpecialWorkspace ? "specialWorkspace" : "workspaces", in ? "In" : "Out"); + + m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME); + m_vRenderOffset.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME); + } + const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle; static auto PWORKSPACEGAP = CConfigValue("general:gaps_workspaces"); diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index dcc7a45f..beb880be 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -471,7 +471,7 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config, } return "unknown style"; - } else if (config == "workspaces" || config == "specialWorkspace") { + } else if (config.starts_with("workspaces") || config.starts_with("specialWorkspace")) { if (style == "slide" || style == "slidevert" || style == "fade") return ""; else if (style.starts_with("slidefade")) { -- 2.45.2