Workspaceanim: respect stack order

This commit is contained in:
vaxerski 2022-05-12 13:03:02 +02:00
parent 15f7886777
commit d4d72ae54d

View file

@ -204,11 +204,14 @@ void CKeybindManager::changeworkspace(std::string args) {
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace); g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
// here and only here begin anim. we don't want to anim visible workspaces on other monitors. // here and only here begin anim. we don't want to anim visible workspaces on other monitors.
// check if anim left or right
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACEID;
// start anim on old workspace // start anim on old workspace
g_pCompositor->getWorkspaceByID(OLDWORKSPACEID)->m_vRenderOffset = Vector2D(-PMONITOR->vecSize.x, 0); g_pCompositor->getWorkspaceByID(OLDWORKSPACEID)->m_vRenderOffset = Vector2D(ANIMTOLEFT ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
// start anim on new workspace // start anim on new workspace
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset.setValueAndWarp(Vector2D(PMONITOR->vecSize.x, 0)); g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset.setValueAndWarp(Vector2D(ANIMTOLEFT ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset = Vector2D(0, 0); g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset = Vector2D(0, 0);
} }
@ -242,14 +245,17 @@ void CKeybindManager::changeworkspace(std::string args) {
const auto OLDWORKSPACE = PMONITOR->activeWorkspace; const auto OLDWORKSPACE = PMONITOR->activeWorkspace;
// get anim direction
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACE;
// start anim on old workspace // start anim on old workspace
g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->m_vRenderOffset = Vector2D(-PMONITOR->vecSize.x, 0); g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->m_vRenderOffset = Vector2D(ANIMTOLEFT ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID); g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID);
const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back(); const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
// start anim on new workspace // start anim on new workspace
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(PMONITOR->vecSize.x, 0)); PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(ANIMTOLEFT ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
PWORKSPACE->m_vRenderOffset = Vector2D(0, 0); PWORKSPACE->m_vRenderOffset = Vector2D(0, 0);
// We are required to set the name here immediately // We are required to set the name here immediately