From e130c39f86c666a2f7206520ad17d566998aef88 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 29 Nov 2005 00:44:42 +0000 Subject: [PATCH] Fix spurious ChangeDisplaySettings calls; this fixes extra graphics hitches when entering fullscreen. --- stepmania/src/archutils/Win32/GraphicsWindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stepmania/src/archutils/Win32/GraphicsWindow.cpp b/stepmania/src/archutils/Win32/GraphicsWindow.cpp index 5000769ec8..313d381a98 100644 --- a/stepmania/src/archutils/Win32/GraphicsWindow.cpp +++ b/stepmania/src/archutils/Win32/GraphicsWindow.cpp @@ -27,6 +27,7 @@ static bool g_bD3D = false; /* If we're fullscreen, this is the mode we set. */ static DEVMODE g_FullScreenDevMode; +static bool g_bRecreatingVideoMode = false; static CString GetNewWindow() { @@ -69,7 +70,7 @@ LRESULT CALLBACK GraphicsWindow::GraphicsWindow_WndProc( HWND hWnd, UINT msg, WP LOG->MapLog( "LOST_FOCUS", "Lost focus to: %s", sStr.c_str() ); } - if( !g_bD3D && !g_CurrentParams.windowed ) + if( !g_bD3D && !g_CurrentParams.windowed && !g_bRecreatingVideoMode ) { /* In OpenGL (not D3D), it's our job to unset and reset the full-screen video mode * when we focus changes, and to hide and show the window. Hiding is done in WM_KILLFOCUS, @@ -96,7 +97,7 @@ LRESULT CALLBACK GraphicsWindow::GraphicsWindow_WndProc( HWND hWnd, UINT msg, WP return 0; } case WM_KILLFOCUS: - if( !g_bD3D && !g_CurrentParams.windowed ) + if( !g_bD3D && !g_CurrentParams.windowed && !g_bRecreatingVideoMode ) ShowWindow( g_hWndMain, SW_SHOWMINNOACTIVE ); break; @@ -253,7 +254,10 @@ void GraphicsWindow::RecreateGraphicsWindow( const VideoModeParams &p ) if( hWnd == NULL ) RageException::Throw( "%s", werr_ssprintf( GetLastError(), "CreateWindow" ).c_str() ); + /* While we change to the new window, don't do ChangeDisplaySettings in WM_ACTIVATE. */ + g_bRecreatingVideoMode = true; SetForegroundWindow( hWnd ); + g_bRecreatingVideoMode = false; DestroyGraphicsWindow();