Mercurial > sdl-ios-xcode
comparison src/video/gapi/SDL_gapivideo.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 | 420b3f47806d |
children | 8d9bb0cf2c2a |
comparison
equal
deleted
inserted
replaced
1522:1078552c83a0 | 1523:21b1fbb53f4a |
---|---|
729 SDL_memset(gapiBuffer, 255, video->h * video->pitch); | 729 SDL_memset(gapiBuffer, 255, video->h * video->pitch); |
730 MoveWindow(SDL_Window, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), FALSE); | 730 MoveWindow(SDL_Window, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), FALSE); |
731 ShowWindow(SDL_Window, SW_SHOW); | 731 ShowWindow(SDL_Window, SW_SHOW); |
732 SetForegroundWindow(SDL_Window); | 732 SetForegroundWindow(SDL_Window); |
733 | 733 |
734 /* JC 14 Mar 2006 | |
735 Flush the message loop or this can cause big problems later | |
736 Especially if the user decides to use dialog boxes or assert()! | |
737 */ | |
738 WIN_FlushMessageQueue(); | |
739 | |
734 /* Open GAPI display */ | 740 /* Open GAPI display */ |
735 if( !gapi->useVga && this->hidden->useGXOpenDisplay ) | 741 if( !gapi->useVga && this->hidden->useGXOpenDisplay ) |
736 if( !gapi->gxFunc.GXOpenDisplay(SDL_Window, GX_FULLSCREEN) ) | 742 if( !gapi->gxFunc.GXOpenDisplay(SDL_Window, GX_FULLSCREEN) ) |
737 { | 743 { |
738 SDL_SetError("Couldn't initialize GAPI"); | 744 SDL_SetError("Couldn't initialize GAPI"); |
1101 | 1107 |
1102 if( gapi->needUpdate ) | 1108 if( gapi->needUpdate ) |
1103 gapi->gxFunc.GXEndDraw(); | 1109 gapi->gxFunc.GXEndDraw(); |
1104 } | 1110 } |
1105 | 1111 |
1106 static void FlushMessageQueue() | |
1107 { | |
1108 MSG msg; | |
1109 while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { | |
1110 if ( msg.message == WM_QUIT ) break; | |
1111 TranslateMessage( &msg ); | |
1112 DispatchMessage( &msg ); | |
1113 } | |
1114 } | |
1115 | |
1116 | |
1117 /* Note: If we are terminated, this could be called in the middle of | 1112 /* Note: If we are terminated, this could be called in the middle of |
1118 another SDL video routine -- notably UpdateRects. | 1113 another SDL video routine -- notably UpdateRects. |
1119 */ | 1114 */ |
1120 void GAPI_VideoQuit(_THIS) | 1115 void GAPI_VideoQuit(_THIS) |
1121 { | 1116 { |
1136 screen_icn = NULL; | 1131 screen_icn = NULL; |
1137 } | 1132 } |
1138 | 1133 |
1139 DIB_DestroyWindow(this); | 1134 DIB_DestroyWindow(this); |
1140 SDL_UnregisterApp(); | 1135 SDL_UnregisterApp(); |
1141 FlushMessageQueue(); | |
1142 | 1136 |
1143 SDL_Window = NULL; | 1137 SDL_Window = NULL; |
1144 #if defined(_WIN32_WCE) | 1138 #if defined(_WIN32_WCE) |
1145 | 1139 |
1146 // Unload wince aygshell library to prevent leak | 1140 // Unload wince aygshell library to prevent leak |