# HG changeset patch # User Sam Lantinga # Date 1029611838 0 # Node ID b37ce4813ad4de6a104628f9a17e280ebc85eea3 # Parent 598b25b9bffe6219bfd1623448650300eb10c6b9 Flush message queue when shutting down video mode on Windows diff -r 598b25b9bffe -r b37ce4813ad4 src/video/windib/SDL_dibvideo.c --- a/src/video/windib/SDL_dibvideo.c Sat Aug 17 19:17:01 2002 +0000 +++ b/src/video/windib/SDL_dibvideo.c Sat Aug 17 19:17:18 2002 +0000 @@ -889,6 +889,16 @@ #endif /* !NO_GAMMA_SUPPORT */ } +static void FlushMessageQueue() +{ + MSG msg; + while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { + if ( msg.message == WM_QUIT ) break; + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } +} + void DIB_VideoQuit(_THIS) { /* Destroy the window and everything associated with it */ @@ -918,6 +928,7 @@ } DIB_QuitGamma(this); DIB_DestroyWindow(this); + FlushMessageQueue(); SDL_Window = NULL; } diff -r 598b25b9bffe -r b37ce4813ad4 src/video/windx5/SDL_dx5video.c --- a/src/video/windx5/SDL_dx5video.c Sat Aug 17 19:17:01 2002 +0000 +++ b/src/video/windx5/SDL_dx5video.c Sat Aug 17 19:17:18 2002 +0000 @@ -2205,6 +2205,16 @@ #endif /* !IDirectDrawGammaControl_SetGammaRamp */ } +static void FlushMessageQueue() +{ + MSG msg; + while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { + if ( msg.message == WM_QUIT ) break; + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } +} + void DX5_VideoQuit(_THIS) { int i, j; @@ -2246,6 +2256,7 @@ DIB_QuitGamma(this); if ( SDL_Window ) { DX5_DestroyWindow(this); + FlushMessageQueue(); } /* Free our window icon */