From 2c968ac962a86f73285535095feab14f87bfad14 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 23 Dec 2021 10:16:53 +0100 Subject: [PATCH] remove fullscreen if tiled window opened behind --- src/events/events.cpp | 13 +++++++++++++ src/windowManager.cpp | 2 +- src/windowManager.hpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/events/events.cpp b/src/events/events.cpp index 5fbcba4..65eeec9 100644 --- a/src/events/events.cpp +++ b/src/events/events.cpp @@ -450,6 +450,19 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) { PWINDOWINARR->setDefaultSize(Vector2D(g_pWindowManager->Screen->width_in_pixels / 2.f, g_pWindowManager->Screen->height_in_pixels / 2.f)); } + // Check if the workspace has a fullscreen window. if so, remove its' fullscreen status. + const auto PWORKSPACE = g_pWindowManager->getWorkspaceByID(g_pWindowManager->activeWorkspaces[CURRENTSCREEN]); + if (PWORKSPACE && PWORKSPACE->getHasFullscreenWindow()) { + const auto PFULLSCREENWINDOW = g_pWindowManager->getFullscreenWindowByWorkspace(PWORKSPACE->getID()); + + if (PFULLSCREENWINDOW) { + PFULLSCREENWINDOW->setFullscreen(false); + PFULLSCREENWINDOW->setDirty(true); + PWORKSPACE->setHasFullscreenWindow(false); + g_pWindowManager->setAllWorkspaceWindowsDirtyByID(PWORKSPACE->getID()); + } + } + // Set the parent // check if lastwindow is on our workspace if (auto PLASTWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow); (PLASTWINDOW && PLASTWINDOW->getWorkspaceID() == g_pWindowManager->activeWorkspaces[CURRENTSCREEN]) || wasfloating || (forcemonitor != -1 && forcemonitor != PMONITOR->ID)) { diff --git a/src/windowManager.cpp b/src/windowManager.cpp index 8d37edf..81e3957 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -1346,7 +1346,7 @@ void CWindowManager::moveActiveWindowTo(char dir) { CWindow* CWindowManager::getFullscreenWindowByWorkspace(const int& id) { for (auto& window : windows) { - if (window.getWorkspaceID() == id && window.getFullscreen()) + if (window.getWorkspaceID() == id && window.getFullscreen() && window.getDrawable() > 0) return &window; } diff --git a/src/windowManager.hpp b/src/windowManager.hpp index 3e4f820..cfc8b43 100644 --- a/src/windowManager.hpp +++ b/src/windowManager.hpp @@ -120,6 +120,7 @@ public: void updateBarInfo(); int getWindowsOnWorkspace(const int&); + CWindow* getFullscreenWindowByWorkspace(const int&); void recalcAllWorkspaces(); @@ -151,7 +152,6 @@ private: SMonitor* getMonitorFromWorkspace(const int&); void recalcEntireWorkspace(const int&); void fixMasterWorkspaceOnClosed(CWindow* pWindow); - CWindow* getFullscreenWindowByWorkspace(const int&); }; inline std::unique_ptr g_pWindowManager = std::make_unique();