summaryrefslogtreecommitdiff
path: root/src/helpers/Workspace.cpp
diff options
context:
space:
mode:
authorend-4 <97237370+end-4@users.noreply.github.com>2023-11-19 19:33:26 +0700
committerGitHub <noreply@github.com>2023-11-19 12:33:26 +0000
commit646f4bc63861e03b01fed3833bb65d1d014e1bf3 (patch)
treebae2cc7a1c718e8c33b9a8bbb64eacc8bec93c5f /src/helpers/Workspace.cpp
parent7e0c90b92c1229b3c453d2fbd1609affa9631ce2 (diff)
general: add workspace gaps (#3877)
* anims: workspace gap * anims: ws gaps: on swipe end * anims: ws gaps: add missing parentheses * format * refractor * Update Swipe.cpp * format * fix swipe to right * ws gaps: move animations:workspace_gap to general:gaps_workspace * ws gaps: general:gaps_workspace -> general:gaps_workspaces
Diffstat (limited to 'src/helpers/Workspace.cpp')
-rw-r--r--src/helpers/Workspace.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp
index 3264b27f..c027688e 100644
--- a/src/helpers/Workspace.cpp
+++ b/src/helpers/Workspace.cpp
@@ -38,7 +38,8 @@ CWorkspace::~CWorkspace() {
}
void CWorkspace::startAnim(bool in, bool left, bool instant) {
- const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
+ const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
+ const auto PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue;
if (ANIMSTYLE.starts_with("slidefade")) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
@@ -90,26 +91,28 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
} else if (ANIMSTYLE == "slidevert") {
// fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
+ const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP;
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
if (in) {
- m_vRenderOffset.setValueAndWarp(Vector2D(0, left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y));
+ m_vRenderOffset.setValueAndWarp(Vector2D(0, left ? YDISTANCE : -YDISTANCE));
m_vRenderOffset = Vector2D(0, 0);
} else {
- m_vRenderOffset = Vector2D(0, left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y);
+ m_vRenderOffset = Vector2D(0, left ? -YDISTANCE : YDISTANCE);
}
} else {
// fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
+ const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
m_fAlpha.setValueAndWarp(1.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.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0));
m_vRenderOffset = Vector2D(0, 0);
} else {
- m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
+ m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0);
}
}