summaryrefslogtreecommitdiff
path: root/src/helpers/Workspace.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-16 23:13:32 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-16 23:13:32 +0200
commitf09de365d5214ea73e6578bd7a72e6c16740b6a0 (patch)
treee9e3b4c906250614ade7f197f5e946ab219e705f /src/helpers/Workspace.cpp
parent25979fac1d77b2e1bed4a518dfe1897d653c7a89 (diff)
Added workspace fade transition
Diffstat (limited to 'src/helpers/Workspace.cpp')
-rw-r--r--src/helpers/Workspace.cpp26
1 files changed, 26 insertions, 0 deletions
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