diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-30 20:44:14 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-30 20:44:14 +0200 |
| commit | eee9698ec90daee9e6f8e3b4f4b242f38287ff81 (patch) | |
| tree | 50e7f87498f0368336eaa414880996869772c962 /src/events/Monitors.cpp | |
| parent | 1f4c938c67dc0eb13963952bb4a061a304b5f246 (diff) | |
move workspaces and not windows on mon disconnect
Diffstat (limited to 'src/events/Monitors.cpp')
| -rw-r--r-- | src/events/Monitors.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 13f99749..4487bf2f 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -309,14 +309,26 @@ void Events::listener_monitorDestroy(void* owner, void* data) { // snap cursor wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f); - // move windows - for (auto& w : g_pCompositor->m_lWindows) { + // move workspaces + std::deque<CWorkspace*> wspToMove; + for (auto& w : g_pCompositor->m_lWorkspaces) { if (w.m_iMonitorID == pMonitor->ID) { - g_pCompositor->moveWindowToWorkspace(&w, BACKUPWORKSPACE); + wspToMove.push_back(&w); } } - g_pCompositor->sanityCheckWorkspaces(); + for (auto& w : wspToMove) { + g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON); + w->startAnim(true, true, true); + } + + pMonitor->activeWorkspace = -1; + + for (auto it = g_pCompositor->m_lWorkspaces.begin(); it != g_pCompositor->m_lWorkspaces.end(); ++it) { + if (it->m_iMonitorID == pMonitor->ID) { + it = g_pCompositor->m_lWorkspaces.erase(it); + } + } Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str()); |
