mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 15:45:58 +01:00
move workspaces and not windows on mon disconnect
This commit is contained in:
parent
1f4c938c67
commit
eee9698ec9
4 changed files with 22 additions and 10 deletions
|
@ -592,7 +592,7 @@ CWorkspace* CCompositor::getWorkspaceByID(const int& id) {
|
||||||
|
|
||||||
void CCompositor::sanityCheckWorkspaces() {
|
void CCompositor::sanityCheckWorkspaces() {
|
||||||
for (auto it = m_lWorkspaces.begin(); it != m_lWorkspaces.end(); ++it) {
|
for (auto it = m_lWorkspaces.begin(); it != m_lWorkspaces.end(); ++it) {
|
||||||
if (getWindowsOnWorkspace(it->m_iID) == 0 && !isWorkspaceVisible(it->m_iID)) {
|
if ((getWindowsOnWorkspace(it->m_iID) == 0 && !isWorkspaceVisible(it->m_iID))) {
|
||||||
it = m_lWorkspaces.erase(it);
|
it = m_lWorkspaces.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ std::string monitorsRequest() {
|
||||||
std::string clientsRequest() {
|
std::string clientsRequest() {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\n",
|
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\n",
|
||||||
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str()), (int)w.m_bIsFloating);
|
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str()), (int)w.m_bIsFloating, w.m_iMonitorID);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ std::string activeWindowRequest() {
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||||
return "Invalid";
|
return "Invalid";
|
||||||
|
|
||||||
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\n",
|
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\n",
|
||||||
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating);
|
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating, (int)PWINDOW->m_iMonitorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string layersRequest() {
|
std::string layersRequest() {
|
||||||
|
|
|
@ -309,14 +309,26 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
||||||
// snap cursor
|
// 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);
|
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
|
// move workspaces
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
std::deque<CWorkspace*> wspToMove;
|
||||||
|
for (auto& w : g_pCompositor->m_lWorkspaces) {
|
||||||
if (w.m_iMonitorID == pMonitor->ID) {
|
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());
|
Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str());
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ void CHyprDwindleLayout::recalculateMonitor(const int& monid) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
// Ignore any recalc events if we have a fullscreen window.
|
// Ignore any recalc events if we have a fullscreen window.
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow)
|
if (!PWORKSPACE || PWORKSPACE->m_bHasFullscreenWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto TOPNODE = getMasterNodeOnWorkspace(PMONITOR->activeWorkspace);
|
const auto TOPNODE = getMasterNodeOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
|
Loading…
Reference in a new issue