From 8bcfda22300d3b656b6f098f9dba5ce5f0914595 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 18 Jul 2022 20:53:29 +0200 Subject: [PATCH] update moveactivetoworkspace logic --- src/managers/KeybindManager.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 86fb2275..1ad338cd 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -429,6 +429,9 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { return; } + auto PSAVEDSIZE = PWINDOW->m_vRealSize.vec(); + auto PSAVEDPOS = PWINDOW->m_vRealPosition.vec(); + g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); g_pKeybindManager->changeworkspace(args); @@ -456,20 +459,21 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { PWORKSPACE->m_bHasFullscreenWindow = false; } + if (PWINDOW->m_bIsFullscreen) { + PWINDOW->m_bIsFullscreen = false; + PSAVEDPOS = PSAVEDPOS + Vector2D(10, 10); + PSAVEDSIZE = PSAVEDSIZE - Vector2D(20, 20); + } + // Hack: So that the layout doesnt find our window at the cursor PWINDOW->m_vPosition = Vector2D(-42069, -42069); - // Save the real position and size because the layout might set its own - const auto PSAVEDSIZE = PWINDOW->m_vRealSize.vec(); - const auto PSAVEDPOS = PWINDOW->m_vRealPosition.vec(); g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW); - // and restore it - PWINDOW->m_vRealPosition.setValue(PSAVEDPOS); - PWINDOW->m_vRealSize.setValue(PSAVEDSIZE); + // and restore it if (PWINDOW->m_bIsFloating) { - PWINDOW->m_vRealPosition.setValue(PWINDOW->m_vRealPosition.vec() - g_pCompositor->getMonitorFromID(OLDWORKSPACE->m_iMonitorID)->vecPosition); - PWINDOW->m_vRealPosition.setValue(PWINDOW->m_vRealPosition.vec() + g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID)->vecPosition); + PWINDOW->m_vRealSize.setValue(PSAVEDSIZE); + PWINDOW->m_vRealPosition.setValueAndWarp(PSAVEDPOS - g_pCompositor->getMonitorFromID(OLDWORKSPACE->m_iMonitorID)->vecPosition + g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID)->vecPosition); PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.vec(); }