simplify workspace sanity checks

This commit is contained in:
Vaxry 2022-12-29 17:06:30 +01:00
parent 5d095bb9e1
commit 0baef17a02

View file

@ -1005,28 +1005,23 @@ CWorkspace* CCompositor::getWorkspaceByID(const int& id) {
} }
void CCompositor::sanityCheckWorkspaces() { void CCompositor::sanityCheckWorkspaces() {
for (auto it = m_vWorkspaces.begin(); it != m_vWorkspaces.end(); ++it) { auto it = m_vWorkspaces.begin();
while (it != m_vWorkspaces.end()) {
const auto WINDOWSONWORKSPACE = getWindowsOnWorkspace((*it)->m_iID); const auto WINDOWSONWORKSPACE = getWindowsOnWorkspace((*it)->m_iID);
if ((WINDOWSONWORKSPACE == 0 && !isWorkspaceVisible((*it)->m_iID))) {
it = m_vWorkspaces.erase(it);
if (it == m_vWorkspaces.end())
break;
continue;
}
if ((*it)->m_bIsSpecialWorkspace && WINDOWSONWORKSPACE == 0) { if ((*it)->m_bIsSpecialWorkspace && WINDOWSONWORKSPACE == 0) {
getMonitorFromID((*it)->m_iMonitorID)->specialWorkspaceID = 0; getMonitorFromID((*it)->m_iMonitorID)->specialWorkspaceID = 0;
it = m_vWorkspaces.erase(it); it = m_vWorkspaces.erase(it);
if (it == m_vWorkspaces.end())
break;
continue; continue;
} }
if ((WINDOWSONWORKSPACE == 0 && !isWorkspaceVisible((*it)->m_iID))) {
it = m_vWorkspaces.erase(it);
continue;
}
++it;
} }
} }