From b94b4049670f3307bc704ab209dad6abc9cbe0cf Mon Sep 17 00:00:00 2001 From: Andreas Traczyk Date: Wed, 23 Mar 2022 18:00:27 -0400 Subject: [PATCH] mainwindow: don't save fullscreen geometry This covers the case where closing the app while in fullscreen mode will save the window geometry. A patch was already made to prevent the client from restoring fullscreen visibility, however, restoring the geometry will stretch the window over the screen giving the impression that it is fullscreen. This patch fixes that behavior. Change-Id: I520d528a0d8fb62c84bfd79d2f2229bcc654bf8f --- src/LayoutManager.qml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/LayoutManager.qml b/src/LayoutManager.qml index 5f1868b1..98516cea 100644 --- a/src/LayoutManager.qml +++ b/src/LayoutManager.qml @@ -71,17 +71,20 @@ QtObject { // Save the window geometry and visibility settings. function saveWindowSettings() { - var geometry = Qt.rect(appWindow.x, appWindow.y, - appWindow.width, appWindow.height) - AppSettingsManager.setValue(Settings.WindowGeometry, geometry) - - // If closed-to-tray or minimized, save the cached windowedVisibility + // If closed-to-tray or minimized or fullscreen, save the cached windowedVisibility // value instead. - if (isHidden) { + if (isHidden || isFullScreen) { AppSettingsManager.setValue(Settings.WindowState, priv.windowedVisibility) } else { AppSettingsManager.setValue(Settings.WindowState, visibility) } + + // Likewise, don't save fullscreen geometry. + const geometry = isFullScreen ? + priv.windowedGeometry : + Qt.rect(appWindow.x, appWindow.y, + appWindow.width, appWindow.height) + AppSettingsManager.setValue(Settings.WindowGeometry, geometry) } // Restore the window geometry and visibility settings. @@ -208,6 +211,9 @@ QtObject { // Used to store the last windowed mode visibility. property int windowedVisibility + // Used to store the last windowed mode geometry. + property rect windowedGeometry + // An stack of items that are fullscreened. property variant fullScreenItems: [] @@ -238,8 +244,10 @@ QtObject { function requestWindowModeChange(fullScreen) { if (fullScreen) { if (!isFullScreen) { - // Save the previous visibility state. + // Save the previous visibility state and geometry. windowedVisibility = visibility + windowedGeometry = Qt.rect(appWindow.x, appWindow.y, + appWindow.width, appWindow.height) showFullScreen() } } else {