Mercurial > sdl-ios-xcode
comparison src/video/windx5/SDL_dx5video.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 |
---|---|
900 | 900 |
901 /* Create the window */ | 901 /* Create the window */ |
902 if ( DX5_CreateWindow(this) < 0 ) { | 902 if ( DX5_CreateWindow(this) < 0 ) { |
903 return(-1); | 903 return(-1); |
904 } | 904 } |
905 | |
905 #if !SDL_AUDIO_DISABLED | 906 #if !SDL_AUDIO_DISABLED |
906 DX5_SoundFocus(SDL_Window); | 907 DX5_SoundFocus(SDL_Window); |
907 #endif | 908 #endif |
908 | 909 |
909 /* Create the DirectDraw object */ | 910 /* Create the DirectDraw object */ |
1602 } | 1603 } |
1603 ShowWindow(SDL_Window, SW_SHOW); | 1604 ShowWindow(SDL_Window, SW_SHOW); |
1604 SetForegroundWindow(SDL_Window); | 1605 SetForegroundWindow(SDL_Window); |
1605 SDL_resizing = 0; | 1606 SDL_resizing = 0; |
1606 | 1607 |
1608 /* JC 14 Mar 2006 | |
1609 Flush the message loop or this can cause big problems later | |
1610 Especially if the user decides to use dialog boxes or assert()! | |
1611 */ | |
1612 WIN_FlushMessageQueue(); | |
1613 | |
1607 /* We're live! */ | 1614 /* We're live! */ |
1608 return(video); | 1615 return(video); |
1609 } | 1616 } |
1610 | 1617 |
1611 struct private_hwdata { | 1618 struct private_hwdata { |
2343 IDirectDrawGammaControl_Release(gamma); | 2350 IDirectDrawGammaControl_Release(gamma); |
2344 return (result == DD_OK) ? 0 : -1; | 2351 return (result == DD_OK) ? 0 : -1; |
2345 #endif /* !IDirectDrawGammaControl_SetGammaRamp */ | 2352 #endif /* !IDirectDrawGammaControl_SetGammaRamp */ |
2346 } | 2353 } |
2347 | 2354 |
2348 static void FlushMessageQueue() | |
2349 { | |
2350 MSG msg; | |
2351 while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { | |
2352 if ( msg.message == WM_QUIT ) break; | |
2353 TranslateMessage( &msg ); | |
2354 DispatchMessage( &msg ); | |
2355 } | |
2356 } | |
2357 | |
2358 void DX5_VideoQuit(_THIS) | 2355 void DX5_VideoQuit(_THIS) |
2359 { | 2356 { |
2360 int i, j; | 2357 int i, j; |
2361 | 2358 |
2362 /* If we're fullscreen GL, we need to reset the display */ | 2359 /* If we're fullscreen GL, we need to reset the display */ |
2396 | 2393 |
2397 /* Free the window */ | 2394 /* Free the window */ |
2398 DIB_QuitGamma(this); | 2395 DIB_QuitGamma(this); |
2399 if ( SDL_Window ) { | 2396 if ( SDL_Window ) { |
2400 DX5_DestroyWindow(this); | 2397 DX5_DestroyWindow(this); |
2401 FlushMessageQueue(); | |
2402 } | 2398 } |
2403 | 2399 |
2404 /* Free our window icon */ | 2400 /* Free our window icon */ |
2405 if ( screen_icn ) { | 2401 if ( screen_icn ) { |
2406 DestroyIcon(screen_icn); | 2402 DestroyIcon(screen_icn); |