Commit da6273a8 authored by Sam Lantinga's avatar Sam Lantinga

Flush message queue when shutting down video mode on Windows

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40443
parent 16a3c5fa
...@@ -889,6 +889,16 @@ int DIB_GetGammaRamp(_THIS, Uint16 *ramp) ...@@ -889,6 +889,16 @@ int DIB_GetGammaRamp(_THIS, Uint16 *ramp)
#endif /* !NO_GAMMA_SUPPORT */ #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) void DIB_VideoQuit(_THIS)
{ {
/* Destroy the window and everything associated with it */ /* Destroy the window and everything associated with it */
...@@ -918,6 +928,7 @@ void DIB_VideoQuit(_THIS) ...@@ -918,6 +928,7 @@ void DIB_VideoQuit(_THIS)
} }
DIB_QuitGamma(this); DIB_QuitGamma(this);
DIB_DestroyWindow(this); DIB_DestroyWindow(this);
FlushMessageQueue();
SDL_Window = NULL; SDL_Window = NULL;
} }
......
...@@ -2205,6 +2205,16 @@ static int DX5_GetGammaRamp(_THIS, Uint16 *ramp) ...@@ -2205,6 +2205,16 @@ static int DX5_GetGammaRamp(_THIS, Uint16 *ramp)
#endif /* !IDirectDrawGammaControl_SetGammaRamp */ #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) void DX5_VideoQuit(_THIS)
{ {
int i, j; int i, j;
...@@ -2246,6 +2256,7 @@ void DX5_VideoQuit(_THIS) ...@@ -2246,6 +2256,7 @@ void DX5_VideoQuit(_THIS)
DIB_QuitGamma(this); DIB_QuitGamma(this);
if ( SDL_Window ) { if ( SDL_Window ) {
DX5_DestroyWindow(this); DX5_DestroyWindow(this);
FlushMessageQueue();
} }
/* Free our window icon */ /* Free our window icon */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment