mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-30 05:05:59 +01:00
monitors: fix some bugs with re-plug
This commit is contained in:
parent
7e5ba5e824
commit
afe8d8dfec
2 changed files with 15 additions and 9 deletions
|
@ -1859,7 +1859,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
||||||
|
|
||||||
const auto POLDMON = getMonitorFromID(pWorkspace->m_iMonitorID);
|
const auto POLDMON = getMonitorFromID(pWorkspace->m_iMonitorID);
|
||||||
|
|
||||||
const bool SWITCHINGISACTIVE = POLDMON->activeWorkspace == pWorkspace->m_iID;
|
const bool SWITCHINGISACTIVE = POLDMON ? POLDMON->activeWorkspace == pWorkspace->m_iID : false;
|
||||||
|
|
||||||
// fix old mon
|
// fix old mon
|
||||||
int nextWorkspaceOnMonitorID = -1;
|
int nextWorkspaceOnMonitorID = -1;
|
||||||
|
@ -1906,6 +1906,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
||||||
|
|
||||||
// additionally, move floating and fs windows manually
|
// additionally, move floating and fs windows manually
|
||||||
if (w->m_bIsMapped && !w->isHidden()) {
|
if (w->m_bIsMapped && !w->isHidden()) {
|
||||||
|
if (POLDMON) {
|
||||||
if (w->m_bIsFloating)
|
if (w->m_bIsFloating)
|
||||||
w->m_vRealPosition = w->m_vRealPosition.vec() - POLDMON->vecPosition + pMonitor->vecPosition;
|
w->m_vRealPosition = w->m_vRealPosition.vec() - POLDMON->vecPosition + pMonitor->vecPosition;
|
||||||
|
|
||||||
|
@ -1913,6 +1914,9 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
||||||
w->m_vRealPosition = pMonitor->vecPosition;
|
w->m_vRealPosition = pMonitor->vecPosition;
|
||||||
w->m_vRealSize = pMonitor->vecSize;
|
w->m_vRealSize = pMonitor->vecSize;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
w->m_vRealPosition = Vector2D{(int)w->m_vRealPosition.goalv().x % (int)pMonitor->vecSize.x, (int)w->m_vRealPosition.goalv().y % (int)pMonitor->vecSize.y};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w->updateToplevel();
|
w->updateToplevel();
|
||||||
|
@ -1936,10 +1940,12 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
||||||
}
|
}
|
||||||
|
|
||||||
// finalize
|
// finalize
|
||||||
|
if (POLDMON) {
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
|
||||||
|
updateFullscreenFadeOnWorkspace(getWorkspaceByID(POLDMON->activeWorkspace));
|
||||||
|
}
|
||||||
|
|
||||||
updateFullscreenFadeOnWorkspace(pWorkspace);
|
updateFullscreenFadeOnWorkspace(pWorkspace);
|
||||||
updateFullscreenFadeOnWorkspace(getWorkspaceByID(POLDMON->activeWorkspace));
|
|
||||||
|
|
||||||
// event
|
// event
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"moveworkspace", pWorkspace->m_szName + "," + pMonitor->szName});
|
g_pEventManager->postEvent(SHyprIPCEvent{"moveworkspace", pWorkspace->m_szName + "," + pMonitor->szName});
|
||||||
|
|
|
@ -145,7 +145,7 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
setupDefaultWS(monitorRule);
|
setupDefaultWS(monitorRule);
|
||||||
|
|
||||||
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
if (ws->m_szLastMonitor == szName) {
|
if (ws->m_szLastMonitor == szName || g_pCompositor->m_vMonitors.size() == 1 /* avoid lost workspaces on recover */) {
|
||||||
g_pCompositor->moveWorkspaceToMonitor(ws.get(), this);
|
g_pCompositor->moveWorkspaceToMonitor(ws.get(), this);
|
||||||
ws->startAnim(true, true, true);
|
ws->startAnim(true, true, true);
|
||||||
ws->m_szLastMonitor = "";
|
ws->m_szLastMonitor = "";
|
||||||
|
|
Loading…
Reference in a new issue