Merge pull request #8307 from unknownbrackets/minor

Allow shortcut min/max on Windows, fix config save on exit
This commit is contained in:
Henrik Rydgård 2015-12-26 10:39:57 +01:00
commit 58ef5ee940
5 changed files with 20 additions and 2 deletions

View file

@ -1085,6 +1085,9 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
// Request the framework to exit cleanly.
System_SendMessage("finish", "");
// However, let's make sure the config was saved, since it may not have been.
g_Config.Save();
// We shouldn't call NativeShutdown here at all, it should be done by the framework.
#ifdef ANDROID
#ifdef ANDROID_NDK_PROFILER

View file

@ -360,6 +360,10 @@ namespace MainWindow
}
}
void Minimize() {
ShowWindow(hwndMain, SW_MINIMIZE);
}
RECT DetermineWindowRectangle() {
RECT rc;

View file

@ -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);

View file

@ -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();

View file

@ -879,15 +879,15 @@ int main(int argc, char *argv[]) {
#ifndef _WIN32
delete joystick;
#endif
NativeShutdownGraphics();
NativeShutdown();
// Faster exit, thanks to the OS. Remove this if you want to debug shutdown
// The speed difference is only really noticable on Linux. On Windows you do notice it though
#ifndef MOBILE_DEVICE
exit(0);
#endif
NativeShutdownGraphics();
SDL_PauseAudio(1);
SDL_CloseAudio();
NativeShutdown();
#ifdef USING_EGL
EGL_Close();
#endif