diff src/video/windib/SDL_dibvideo.c @ 1523:21b1fbb53f4a

(patch tweaked a bit) Date: Tue, 14 Mar 2006 03:30:11 +0000 From: Peter Mulholland Subject: [SDL] Windows MessageBox() strangeness fixes Hello all, I *think* this should fix the issues that people were seeing with MessageBox() not working and therefore assert() on mingw/msvc. Forgive me if i've screwed up making the diff file - I'm a total newb when it comes to things like CVS and diff. It modifies a few files as I saw that FlushMessageQueue() was in both the windx5 and windib driver, so I moved this into wincommon. It was also in the gapi driver, so I changed that too. The function is now WIN_FlushMessageQueue() in src/video/wincommon/SDL_syswm.c
author Sam Lantinga <slouken@libsdl.org>
date Tue, 14 Mar 2006 04:00:03 +0000
parents 0a2bd6507477
children 8d9bb0cf2c2a
line wrap: on
line diff
--- a/src/video/windib/SDL_dibvideo.c	Tue Mar 14 03:04:50 2006 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Tue Mar 14 04:00:03 2006 +0000
@@ -291,6 +291,7 @@
 	if ( DIB_CreateWindow(this) < 0 ) {
 		return(-1);
 	}
+
 #if !SDL_AUDIO_DISABLED
 	DX5_SoundFocus(SDL_Window);
 #endif
@@ -818,6 +819,12 @@
 		video->flags |= SDL_OPENGL;
 	}
 
+	/* JC 14 Mar 2006
+		Flush the message loop or this can cause big problems later
+		Especially if the user decides to use dialog boxes or assert()!
+	*/
+	WIN_FlushMessageQueue();
+
 	/* We're live! */
 	return(video);
 }
@@ -1014,16 +1021,6 @@
 #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 */
@@ -1051,7 +1048,6 @@
 		}
 		DIB_QuitGamma(this);
 		DIB_DestroyWindow(this);
-		FlushMessageQueue();
 
 		SDL_Window = NULL;