comparison 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
comparison
equal deleted inserted replaced
1522:1078552c83a0 1523:21b1fbb53f4a
289 289
290 /* Create the window */ 290 /* Create the window */
291 if ( DIB_CreateWindow(this) < 0 ) { 291 if ( DIB_CreateWindow(this) < 0 ) {
292 return(-1); 292 return(-1);
293 } 293 }
294
294 #if !SDL_AUDIO_DISABLED 295 #if !SDL_AUDIO_DISABLED
295 DX5_SoundFocus(SDL_Window); 296 DX5_SoundFocus(SDL_Window);
296 #endif 297 #endif
297 298
298 /* Determine the screen depth */ 299 /* Determine the screen depth */
816 return(NULL); 817 return(NULL);
817 } 818 }
818 video->flags |= SDL_OPENGL; 819 video->flags |= SDL_OPENGL;
819 } 820 }
820 821
822 /* JC 14 Mar 2006
823 Flush the message loop or this can cause big problems later
824 Especially if the user decides to use dialog boxes or assert()!
825 */
826 WIN_FlushMessageQueue();
827
821 /* We're live! */ 828 /* We're live! */
822 return(video); 829 return(video);
823 } 830 }
824 831
825 /* We don't actually allow hardware surfaces in the DIB driver */ 832 /* We don't actually allow hardware surfaces in the DIB driver */
1012 ReleaseDC(SDL_Window, hdc); 1019 ReleaseDC(SDL_Window, hdc);
1013 return succeeded ? 0 : -1; 1020 return succeeded ? 0 : -1;
1014 #endif /* !NO_GAMMA_SUPPORT */ 1021 #endif /* !NO_GAMMA_SUPPORT */
1015 } 1022 }
1016 1023
1017 static void FlushMessageQueue()
1018 {
1019 MSG msg;
1020 while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
1021 if ( msg.message == WM_QUIT ) break;
1022 TranslateMessage( &msg );
1023 DispatchMessage( &msg );
1024 }
1025 }
1026
1027 void DIB_VideoQuit(_THIS) 1024 void DIB_VideoQuit(_THIS)
1028 { 1025 {
1029 /* Destroy the window and everything associated with it */ 1026 /* Destroy the window and everything associated with it */
1030 if ( SDL_Window ) { 1027 if ( SDL_Window ) {
1031 /* Delete the screen bitmap (also frees screen->pixels) */ 1028 /* Delete the screen bitmap (also frees screen->pixels) */
1049 DestroyIcon(screen_icn); 1046 DestroyIcon(screen_icn);
1050 screen_icn = NULL; 1047 screen_icn = NULL;
1051 } 1048 }
1052 DIB_QuitGamma(this); 1049 DIB_QuitGamma(this);
1053 DIB_DestroyWindow(this); 1050 DIB_DestroyWindow(this);
1054 FlushMessageQueue();
1055 1051
1056 SDL_Window = NULL; 1052 SDL_Window = NULL;
1057 1053
1058 #if defined(_WIN32_WCE) 1054 #if defined(_WIN32_WCE)
1059 1055