From 6e48f907dd205e374bd0ee6458fd525e3f205d3e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 25 Dec 2015 19:18:32 -0800 Subject: [PATCH] Support minimize and maximize state. Fixes #6893. Minimize is mostly useful for tooling, and maximize is a more user-friendly way of specifying a fullscreen shortcut. --- Windows/MainWindow.cpp | 4 ++++ Windows/MainWindow.h | 1 + Windows/main.cpp | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index d5933d100..1c5e12b5f 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -360,6 +360,10 @@ namespace MainWindow } } + void Minimize() { + ShowWindow(hwndMain, SW_MINIMIZE); + } + RECT DetermineWindowRectangle() { RECT rc; diff --git a/Windows/MainWindow.h b/Windows/MainWindow.h index d2459edfe..c03b2b268 100644 --- a/Windows/MainWindow.h +++ b/Windows/MainWindow.h @@ -62,6 +62,7 @@ namespace MainWindow HINSTANCE GetHInstance(); HWND GetDisplayHWND(); void ToggleFullscreen(HWND hWnd, bool goingFullscreen); + void Minimize(); void SendToggleFullscreen(bool fullscreen); // To be used off-thread void ToggleDebugConsoleVisibility(); void SetInternalResolution(int res = -1); diff --git a/Windows/main.cpp b/Windows/main.cpp index c4c79c809..0d872e3b9 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -482,6 +482,11 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin g_Config.bEnableLogging = true; #endif + if (iCmdShow == SW_MAXIMIZE) { + // Consider this to mean --fullscreen. + g_Config.bFullScreen = true; + } + LogManager::Init(); // Consider at least the following cases before changing this code: // - By default in Release, the console should be hidden by default even if logging is enabled. @@ -521,6 +526,11 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin MainWindow::CreateDebugWindows(); + const bool minimized = iCmdShow == SW_MINIMIZE || iCmdShow == SW_SHOWMINIMIZED || iCmdShow == SW_SHOWMINNOACTIVE; + if (minimized) { + MainWindow::Minimize(); + } + // Emu thread is always running! EmuThread_Start(); InputDevice::BeginPolling();