From e5af156af58b7eeeb86e0e32da60fe4bcfc40c28 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 13 Jan 2004 22:34:55 +0000 Subject: [PATCH] fix input not working after changing video settings, probably other obscure problems --- stepmania/src/StepMania.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 174c3f3224..7a7583b38e 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -134,6 +134,19 @@ static void ChangeToDirOfExecutable(const char *argv0) #endif } +void UpdateHWnd() +{ +#ifdef _WINDOWS + /* Grab the window manager specific information */ + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + if ( SDL_GetWMInfo(&info) < 0 ) + RageException::Throw( "SDL_GetWMInfo failed" ); + + g_hWndMain = info.window; +#endif +} + static RageDisplay::VideoModeParams GetCurVideoModeParams() { return RageDisplay::VideoModeParams( @@ -201,6 +214,9 @@ void ApplyGraphicOptions() StoreActualGraphicOptions( false ); + /* Recreating the window changes the hwnd. */ + UpdateHWnd(); + /* Give the input handlers a chance to re-open devices as necessary. */ INPUTMAN->WindowReset(); } @@ -939,15 +955,7 @@ int main(int argc, char* argv[]) mySDL_EventState(SDL_QUIT, SDL_ENABLE); mySDL_EventState(SDL_ACTIVEEVENT, SDL_ENABLE); - /* Grab the window manager specific information */ - SDL_SysWMinfo info; - SDL_VERSION(&info.version); - if ( SDL_GetWMInfo(&info) < 0 ) - RageException::Throw( "SDL_GetWMInfo failed" ); - -#ifdef _WINDOWS - g_hWndMain = info.window; -#endif + UpdateHWnd(); SONGMAN->PreloadSongImages();