GraphicsWindow: reset screen mode before destroying window
This will prevent a display flicker upon exit of the game. The display's mode should be reset by the time the graphics window has been destroyed.
This commit is contained in:
@@ -436,6 +436,12 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
|
|||||||
/** @brief Shut down the window, but don't reset the video mode. */
|
/** @brief Shut down the window, but don't reset the video mode. */
|
||||||
void GraphicsWindow::DestroyGraphicsWindow()
|
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 )
|
if( g_HDC != nullptr )
|
||||||
{
|
{
|
||||||
ReleaseDC( g_hWndMain, g_HDC );
|
ReleaseDC( g_hWndMain, g_HDC );
|
||||||
@@ -526,12 +532,6 @@ void GraphicsWindow::Shutdown()
|
|||||||
{
|
{
|
||||||
DestroyGraphicsWindow();
|
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;
|
AppInstance inst;
|
||||||
UnregisterClass( g_sClassName.c_str(), inst );
|
UnregisterClass( g_sClassName.c_str(), inst );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user