From 8c27b5f4562e642ea0465873447bbd6fab3603bb Mon Sep 17 00:00:00 2001 From: The Dax Date: Tue, 29 Jul 2014 18:18:57 -0400 Subject: [PATCH] Win32: Fix a minor fullscreen bug. If the window is maximized before going fullscreen, the taskbar appears on top, which is not desirable. Also, apply the maximized state properly again after exiting, if the user had the window maximized. --- Windows/WndMainWindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index ac2543bac8..ad1e418adb 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -135,6 +135,7 @@ namespace MainWindow static W32Util::AsyncBrowseDialog *browseDialog; static bool browsePauseAfter; static bool g_inModeSwitch; // when true, don't react to WM_SIZE + static int g_WindowState; #define MAX_LOADSTRING 100 const TCHAR *szTitle = TEXT("PPSSPP"); @@ -328,6 +329,11 @@ namespace MainWindow // Put back the menu bar. ::SetMenu(hWnd, menu); } else { + // If the window was maximized before going fullscreen, make sure to restore first + // in order not to have the taskbar show up on top of PPSSPP. + if (g_WindowState == SIZE_MAXIMIZED) { + ShowWindow(hwndMain, SW_RESTORE); + } // Remember the normal window rectangle. ::GetWindowRect(hWnd, &g_normalRC); @@ -345,7 +351,12 @@ namespace MainWindow ::SetMenu(hWnd, goingFullscreen ? NULL : menu); // Resize to the appropriate view. - ShowWindow(hwndMain, goingFullscreen ? SW_MAXIMIZE : SW_RESTORE); + // If we're returning to window mode, re-apply the appropriate size setting. + if (goingFullscreen) { + ShowWindow(hwndMain, SW_MAXIMIZE); + } else { + ShowWindow(hwndMain, g_WindowState == SIZE_MAXIMIZED ? SW_MAXIMIZE : SW_RESTORE); + } g_Config.bFullScreen = goingFullscreen; CorrectCursor(); @@ -1098,6 +1109,7 @@ namespace MainWindow } SavePosition(); ResizeDisplay(); + g_WindowState = wParam; break; case SIZE_MINIMIZED: Core_NotifyWindowHidden(true);