changeset 442:b37ce4813ad4

Flush message queue when shutting down video mode on Windows
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Aug 2002 19:17:18 +0000
parents 598b25b9bffe
children 778b970cec12
files src/video/windib/SDL_dibvideo.c src/video/windx5/SDL_dx5video.c
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}
--- 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 */