diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-18 13:10:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-18 13:10:22 +0200 |
| commit | 6c437763f65489b7c720c56d2f2f69781a39e497 (patch) | |
| tree | 81d0fd4a54d5891558b62969ba3b41853dd761ff /src/helpers/Workspace.cpp | |
| parent | c2922b6b0941fc5fd4e82877df179e14cc2d3f93 (diff) | |
| parent | ba573a529afdbf368aa632cf70b41c9a0595578b (diff) | |
Merge branch 'main' into scaling
Diffstat (limited to 'src/helpers/Workspace.cpp')
| -rw-r--r-- | src/helpers/Workspace.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index e4065907..5341fdf7 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -23,6 +23,9 @@ 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); } CWorkspace::~CWorkspace() { @@ -33,4 +36,32 @@ 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") { + 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; + } else { + m_fAlpha.setValueAndWarp(255.f); + m_fAlpha = 0.f; + } + } 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); + } else { + m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0); + } + } }
\ No newline at end of file |
