From 5e2a79e1d3de9375a1540ce6231fac8e49a6d780 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 15 Jan 2006 00:34:21 +0000 Subject: [PATCH] nudge CreateGraphicsWindow and RecreateGraphicsWindow together --- stepmania/src/archutils/Win32/GraphicsWindow.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/stepmania/src/archutils/Win32/GraphicsWindow.cpp b/stepmania/src/archutils/Win32/GraphicsWindow.cpp index 334c91c667..ded2e2193b 100644 --- a/stepmania/src/archutils/Win32/GraphicsWindow.cpp +++ b/stepmania/src/archutils/Win32/GraphicsWindow.cpp @@ -260,12 +260,18 @@ 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; + /* If an old window exists, transfer focus to the new window before deleting + * it, or some other window may temporarily get focus, which can cause it + * to be resized. */ + if( g_hWndMain != NULL ) + { + /* While we change to the new window, don't do ChangeDisplaySettings in WM_ACTIVATE. */ + g_bRecreatingVideoMode = true; + SetForegroundWindow( hWnd ); + g_bRecreatingVideoMode = false; - DestroyGraphicsWindow(); + DestroyGraphicsWindow(); + } g_hWndMain = hWnd; CrashHandler::SetForegroundWindow( g_hWndMain );