dwindle: preserve fs state on switchWindows

fixes #2842
This commit is contained in:
Vaxry 2024-03-10 22:27:17 +00:00
parent 981296f101
commit 0a1632a79f
2 changed files with 16 additions and 5 deletions

View file

@ -175,7 +175,7 @@ class CCompositor {
void swapActiveWorkspaces(CMonitor*, CMonitor*); void swapActiveWorkspaces(CMonitor*, CMonitor*);
CMonitor* getMonitorFromString(const std::string&); CMonitor* getMonitorFromString(const std::string&);
bool workspaceIDOutOfBounds(const int64_t&); bool workspaceIDOutOfBounds(const int64_t&);
void setWindowFullscreen(CWindow*, bool, eFullscreenMode); void setWindowFullscreen(CWindow*, bool, eFullscreenMode mode = FULLSCREEN_INVALID);
void updateFullscreenFadeOnWorkspace(CWorkspace*); void updateFullscreenFadeOnWorkspace(CWorkspace*);
CWindow* getX11Parent(CWindow*); CWindow* getX11Parent(CWindow*);
void scheduleFrameForMonitor(CMonitor*); void scheduleFrameForMonitor(CMonitor*);

View file

@ -963,9 +963,16 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
auto PNODE = getNodeFromWindow(pWindow); auto PNODE = getNodeFromWindow(pWindow);
auto PNODE2 = getNodeFromWindow(pWindow2); auto PNODE2 = getNodeFromWindow(pWindow2);
if (!PNODE2 || !PNODE) { if (!PNODE2 || !PNODE)
return; return;
}
const bool FS1 = pWindow->m_bIsFullscreen;
const bool FS2 = pWindow2->m_bIsFullscreen;
if (FS1)
g_pCompositor->setWindowFullscreen(pWindow, false);
if (FS2)
g_pCompositor->setWindowFullscreen(pWindow2, false);
SDwindleNodeData* ACTIVE1 = nullptr; SDwindleNodeData* ACTIVE1 = nullptr;
SDwindleNodeData* ACTIVE2 = nullptr; SDwindleNodeData* ACTIVE2 = nullptr;
@ -982,9 +989,8 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
// recalc the workspace // recalc the workspace
getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive(); getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive();
if (PNODE2->workspaceID != PNODE->workspaceID) { if (PNODE2->workspaceID != PNODE->workspaceID)
getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive(); getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive();
}
if (ACTIVE1) { if (ACTIVE1) {
ACTIVE1->box = PNODE->box; ACTIVE1->box = PNODE->box;
@ -1000,6 +1006,11 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
g_pHyprRenderer->damageWindow(pWindow); g_pHyprRenderer->damageWindow(pWindow);
g_pHyprRenderer->damageWindow(pWindow2); g_pHyprRenderer->damageWindow(pWindow2);
if (FS1)
g_pCompositor->setWindowFullscreen(pWindow2, true);
if (FS2)
g_pCompositor->setWindowFullscreen(pWindow, true);
} }
void CHyprDwindleLayout::alterSplitRatio(CWindow* pWindow, float ratio, bool exact) { void CHyprDwindleLayout::alterSplitRatio(CWindow* pWindow, float ratio, bool exact) {