internal: save previous workspace before change (#6202)

This commit is contained in:
shezdy 2024-05-23 05:01:12 -06:00 committed by GitHub
parent 7ad9116de8
commit 25b9446949
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1071,6 +1071,14 @@ void CKeybindManager::changeworkspace(std::string args) {
g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER); g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER);
if (BISWORKSPACECURRENT) {
if (*PALLOWWORKSPACECYCLES)
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
else if (!EXPLICITPREVIOUS && !*PBACKANDFORTH)
pWorkspaceToChangeTo->rememberPrevWorkspace(nullptr);
} else
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo, false, true); PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo, false, true);
if (PMONITOR != PMONITORWORKSPACEOWNER) { if (PMONITOR != PMONITORWORKSPACEOWNER) {
@ -1083,14 +1091,6 @@ void CKeybindManager::changeworkspace(std::string args) {
g_pCompositor->warpCursorTo(middle); g_pCompositor->warpCursorTo(middle);
} }
if (BISWORKSPACECURRENT) {
if (*PALLOWWORKSPACECYCLES)
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
else if (!EXPLICITPREVIOUS && !*PBACKANDFORTH)
pWorkspaceToChangeTo->rememberPrevWorkspace(nullptr);
} else
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
if (!g_pInputManager->m_bLastFocusOnLS) { if (!g_pInputManager->m_bLastFocusOnLS) {
if (g_pCompositor->m_pLastFocus) if (g_pCompositor->m_pLastFocus)
g_pInputManager->sendMotionEventsToFocused(); g_pInputManager->sendMotionEventsToFocused();
@ -1163,13 +1163,13 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
else if (POLDWS->m_bIsSpecialWorkspace) else if (POLDWS->m_bIsSpecialWorkspace)
g_pCompositor->getMonitorFromID(POLDWS->m_iMonitorID)->setSpecialWorkspace(nullptr); g_pCompositor->getMonitorFromID(POLDWS->m_iMonitorID)->setSpecialWorkspace(nullptr);
if (*PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS);
pMonitor->changeWorkspace(pWorkspace); pMonitor->changeWorkspace(pWorkspace);
g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PWINDOW);
g_pCompositor->warpCursorTo(PWINDOW->middle()); g_pCompositor->warpCursorTo(PWINDOW->middle());
if (*PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS);
} }
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {