Don't ignore previous maximise on defullscreen req (#1393)

When defullscreening a window by the apps' request, we would return
the window to normal mode, even if the window was previously maximized.
Now a defullscreening request honors the previous maximized state.
This commit is contained in:
scorpion-26 2023-01-17 13:20:10 +01:00 committed by GitHub
parent f14e808847
commit c31c627cf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -111,6 +111,7 @@ class CWindow {
bool m_bIsFloating = false; bool m_bIsFloating = false;
bool m_bDraggingTiled = false; // for dragging around tiled windows bool m_bDraggingTiled = false; // for dragging around tiled windows
bool m_bIsFullscreen = false; bool m_bIsFullscreen = false;
bool m_bWasMaximized = false;
uint64_t m_iMonitorID = -1; uint64_t m_iMonitorID = -1;
std::string m_szTitle = ""; std::string m_szTitle = "";
int m_iWorkspaceID = -1; int m_iWorkspaceID = -1;

View file

@ -767,11 +767,23 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
if (REQUESTED->fullscreen && PWINDOW->m_bIsFullscreen) { if (REQUESTED->fullscreen && PWINDOW->m_bIsFullscreen) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
if (PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL) { if (PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL) {
// Store that we were maximized
PWINDOW->m_bWasMaximized = true;
g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_MAXIMIZED); g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_MAXIMIZED);
g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL); g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL);
} }
} else if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen && !PWINDOW->m_bFakeFullscreenState) else
PWINDOW->m_bWasMaximized = false;
} else if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen && !PWINDOW->m_bFakeFullscreenState) {
g_pCompositor->setWindowFullscreen(PWINDOW, REQUESTED->fullscreen, FULLSCREEN_FULL); g_pCompositor->setWindowFullscreen(PWINDOW, REQUESTED->fullscreen, FULLSCREEN_FULL);
if (PWINDOW->m_bWasMaximized && !REQUESTED->fullscreen) {
// Was maximized before the fullscreen request, return now back to maximized instead of normal
g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_MAXIMIZED);
}
}
// Disable the maximize flag when we recieve a de-fullscreen request
PWINDOW->m_bWasMaximized &= REQUESTED->fullscreen;
requestedFullState = REQUESTED->fullscreen; requestedFullState = REQUESTED->fullscreen;