mirror of
https://github.com/yawut/SDL.git
synced 2026-08-21 16:24:37 -05:00
Flush message queue when shutting down video mode on Windows
This commit is contained in:
@@ -889,6 +889,16 @@ int DIB_GetGammaRamp(_THIS, Uint16 *ramp)
|
||||
#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 @@ void DIB_VideoQuit(_THIS)
|
||||
}
|
||||
DIB_QuitGamma(this);
|
||||
DIB_DestroyWindow(this);
|
||||
FlushMessageQueue();
|
||||
|
||||
SDL_Window = NULL;
|
||||
}
|
||||
|
||||
@@ -2205,6 +2205,16 @@ static int DX5_GetGammaRamp(_THIS, Uint16 *ramp)
|
||||
#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 @@ void DX5_VideoQuit(_THIS)
|
||||
DIB_QuitGamma(this);
|
||||
if ( SDL_Window ) {
|
||||
DX5_DestroyWindow(this);
|
||||
FlushMessageQueue();
|
||||
}
|
||||
|
||||
/* Free our window icon */
|
||||
|
||||
Reference in New Issue
Block a user