remove fullscreen if tiled window opened behind

This commit is contained in:
vaxerski 2021-12-23 10:16:53 +01:00
parent cb0371dab1
commit 2c968ac962
3 changed files with 15 additions and 2 deletions

View file

@ -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)); 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 // Set the parent
// check if lastwindow is on our workspace // 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)) { if (auto PLASTWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow); (PLASTWINDOW && PLASTWINDOW->getWorkspaceID() == g_pWindowManager->activeWorkspaces[CURRENTSCREEN]) || wasfloating || (forcemonitor != -1 && forcemonitor != PMONITOR->ID)) {

View file

@ -1346,7 +1346,7 @@ void CWindowManager::moveActiveWindowTo(char dir) {
CWindow* CWindowManager::getFullscreenWindowByWorkspace(const int& id) { CWindow* CWindowManager::getFullscreenWindowByWorkspace(const int& id) {
for (auto& window : windows) { for (auto& window : windows) {
if (window.getWorkspaceID() == id && window.getFullscreen()) if (window.getWorkspaceID() == id && window.getFullscreen() && window.getDrawable() > 0)
return &window; return &window;
} }

View file

@ -120,6 +120,7 @@ public:
void updateBarInfo(); void updateBarInfo();
int getWindowsOnWorkspace(const int&); int getWindowsOnWorkspace(const int&);
CWindow* getFullscreenWindowByWorkspace(const int&);
void recalcAllWorkspaces(); void recalcAllWorkspaces();
@ -151,7 +152,6 @@ private:
SMonitor* getMonitorFromWorkspace(const int&); SMonitor* getMonitorFromWorkspace(const int&);
void recalcEntireWorkspace(const int&); void recalcEntireWorkspace(const int&);
void fixMasterWorkspaceOnClosed(CWindow* pWindow); void fixMasterWorkspaceOnClosed(CWindow* pWindow);
CWindow* getFullscreenWindowByWorkspace(const int&);
}; };
inline std::unique_ptr<CWindowManager> g_pWindowManager = std::make_unique<CWindowManager>(); inline std::unique_ptr<CWindowManager> g_pWindowManager = std::make_unique<CWindowManager>();