diff --git a/src/archutils/Win32/GraphicsWindow.cpp b/src/archutils/Win32/GraphicsWindow.cpp index d37950a46c..4d2cdbcde7 100644 --- a/src/archutils/Win32/GraphicsWindow.cpp +++ b/src/archutils/Win32/GraphicsWindow.cpp @@ -436,6 +436,12 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce /** @brief Shut down the window, but don't reset the video mode. */ void GraphicsWindow::DestroyGraphicsWindow() { + // If we were in fullscreen, release the display mode before destroying the window + if( g_hWndMain && !g_CurrentParams.windowed ) + { + ChangeDisplaySettingsEx(g_CurrentParams.sDisplayId, nullptr, nullptr, 0, nullptr); + } + if( g_HDC != nullptr ) { ReleaseDC( g_hWndMain, g_HDC ); @@ -526,12 +532,6 @@ void GraphicsWindow::Shutdown() { DestroyGraphicsWindow(); - /* Return to the desktop resolution, if needed. - * It'd be nice to not do this: Windows will do it when we quit, and if - * we're shutting down OpenGL to try D3D, this will cause extra mode - * switches. However, we need to do this before displaying dialogs. */ - ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr ); - AppInstance inst; UnregisterClass( g_sClassName.c_str(), inst ); }