This commit is contained in:
vaxerski 2022-01-04 12:07:32 +01:00
parent 8512fc63cc
commit 14c76ac03f
2 changed files with 13 additions and 4 deletions

View file

@ -507,9 +507,9 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
if (auto PLASTWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow); (PLASTWINDOW && PLASTWINDOW->getWorkspaceID() == g_pWindowManager->activeWorkspaces[CURRENTSCREEN]) || wasfloating || (forcemonitor != -1 && forcemonitor != PMONITOR->ID)) { if (auto PLASTWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow); (PLASTWINDOW && PLASTWINDOW->getWorkspaceID() == g_pWindowManager->activeWorkspaces[CURRENTSCREEN]) || wasfloating || (forcemonitor != -1 && forcemonitor != PMONITOR->ID)) {
// LastWindow is on our workspace, let's make a new split node // LastWindow is on our workspace, let's make a new split node
if (wasfloating || (forcemonitor != -1 && forcemonitor != PMONITOR->ID) || PLASTWINDOW->getIsFloating()) { if (wasfloating || (forcemonitor != -1 && forcemonitor != PMONITOR->ID) || (forcemonitor != -1 && PLASTWINDOW->getWorkspaceID() != g_pWindowManager->activeWorkspaces[CURRENTSCREEN]) || PLASTWINDOW->getIsFloating()) {
// if it's force monitor, find the first on a workspace. // if it's force monitor, find the first on a workspace.
if (forcemonitor != -1 && forcemonitor != PMONITOR->ID) { if ((forcemonitor != -1 && forcemonitor != PMONITOR->ID) || (forcemonitor != -1 && PLASTWINDOW->getWorkspaceID() != g_pWindowManager->activeWorkspaces[CURRENTSCREEN])) {
PLASTWINDOW = g_pWindowManager->findFirstWindowOnWorkspace(g_pWindowManager->activeWorkspaces[CURRENTSCREEN]); PLASTWINDOW = g_pWindowManager->findFirstWindowOnWorkspace(g_pWindowManager->activeWorkspaces[CURRENTSCREEN]);
} else { } else {
// find a window manually by the cursor // find a window manually by the cursor

View file

@ -135,7 +135,7 @@ void CWindowManager::setupRandrMonitors() {
xcb_flush(DisplayConnection); xcb_flush(DisplayConnection);
if (monitors.size() == 0) { if (monitors.size() == 0 || true) {
// RandR failed! // RandR failed!
Debug::log(WARN, "RandR failed!"); Debug::log(WARN, "RandR failed!");
monitors.clear(); monitors.clear();
@ -1350,16 +1350,25 @@ void CWindowManager::warpCursorTo(Vector2D to) {
void CWindowManager::moveActiveWindowToWorkspace(int workspace) { void CWindowManager::moveActiveWindowToWorkspace(int workspace) {
const auto PWINDOW = getWindowFromDrawable(LastWindow); auto PWINDOW = getWindowFromDrawable(LastWindow);
if (!PWINDOW) if (!PWINDOW)
return; return;
if (PWINDOW->getWorkspaceID() == workspace)
return;
Debug::log(LOG, "Moving active window to " + std::to_string(workspace));
const auto SAVEDDEFAULTSIZE = PWINDOW->getDefaultSize(); const auto SAVEDDEFAULTSIZE = PWINDOW->getDefaultSize();
const auto SAVEDFLOATSTATUS = PWINDOW->getIsFloating(); const auto SAVEDFLOATSTATUS = PWINDOW->getIsFloating();
const auto SAVEDDRAWABLE = PWINDOW->getDrawable(); const auto SAVEDDRAWABLE = PWINDOW->getDrawable();
fixWindowOnClose(PWINDOW); fixWindowOnClose(PWINDOW);
// deque reallocated
LastWindow = SAVEDDRAWABLE;
PWINDOW = getWindowFromDrawable(LastWindow);
PWINDOW->setDead(false);
if (const auto WORKSPACE = getWorkspaceByID(PWINDOW->getWorkspaceID()); WORKSPACE && PWINDOW->getFullscreen()) if (const auto WORKSPACE = getWorkspaceByID(PWINDOW->getWorkspaceID()); WORKSPACE && PWINDOW->getFullscreen())
WORKSPACE->setHasFullscreenWindow(false); WORKSPACE->setHasFullscreenWindow(false);