moveActiveToWorkspace: update last window of old ws

This commit is contained in:
vaxerski 2023-05-22 19:44:10 +02:00
parent 086f724951
commit 088b4a68e6

View file

@ -880,21 +880,25 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
} }
auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID); auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID);
CMonitor* pMonitor = nullptr;
const auto POLDWS = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
if (pWorkspace) { if (pWorkspace) {
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace); g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID); pMonitor = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
g_pCompositor->setActiveMonitor(PMONITOR); g_pCompositor->setActiveMonitor(pMonitor);
PMONITOR->changeWorkspace(pWorkspace);
} else { } else {
pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->m_iMonitorID, workspaceName); pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->m_iMonitorID, workspaceName);
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID); pMonitor = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace); g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
PMONITOR->changeWorkspace(pWorkspace);
} }
POLDWS->m_pLastFocusedWindow = g_pCompositor->getFirstWindowOnWorkspace(POLDWS->m_iID);
pMonitor->changeWorkspace(pWorkspace);
g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PWINDOW);
g_pCompositor->warpCursorTo(PWINDOW->middle()); g_pCompositor->warpCursorTo(PWINDOW->middle());
} }