SDL_windowsmessagebox.c: go back to hg rev 14458 state.

encountering a NULL caption in AddDialogString() is intended, i.e.
AddDialogStaticIcon() sends it as NULL on purpose.
main
Ozkan Sezer 2020-12-17 23:50:00 +03:00
parent 4d6eb30523
commit 10625f9d89
1 changed files with 5 additions and 4 deletions

View File

@ -256,6 +256,10 @@ static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string)
size_t count; size_t count;
SDL_bool status; SDL_bool status;
if (!string) {
string = "";
}
wstring = WIN_UTF8ToString(string); wstring = WIN_UTF8ToString(string);
if (!wstring) { if (!wstring) {
return SDL_FALSE; return SDL_FALSE;
@ -314,7 +318,7 @@ static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style,
if (!AddDialogData(dialog, &type, sizeof(type))) { if (!AddDialogData(dialog, &type, sizeof(type))) {
return SDL_FALSE; return SDL_FALSE;
} }
if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL && caption[0])) { if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL)) {
if (!AddDialogString(dialog, caption)) { if (!AddDialogString(dialog, caption)) {
return SDL_FALSE; return SDL_FALSE;
} }
@ -580,7 +584,6 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
} }
/* Jan 25th, 2013 - dant@fleetsa.com /* Jan 25th, 2013 - dant@fleetsa.com
*
* *
* I've tried to make this more reasonable, but I've run in to a lot * I've tried to make this more reasonable, but I've run in to a lot
* of nonsense. * of nonsense.
@ -605,8 +608,6 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
* somewhat correct. * somewhat correct.
* *
* Honestly, a long term solution is to use CreateWindow, not CreateDialog. * Honestly, a long term solution is to use CreateWindow, not CreateDialog.
*
* *
* In order to get text dimensions we need to have a DC with the desired font. * In order to get text dimensions we need to have a DC with the desired font.
* I'm assuming a dialog box in SDL is rare enough we can to the create. * I'm assuming a dialog box in SDL is rare enough we can to the create.