fixes after ShowMessageBox changes:

- SDL_video.c (SDL_ShowMessageBox): remove C99'ism.
- SDL_os2video.c (OS2DIVE_bootstrap): add OS2_ShowMessageBox
- SDL_os2video.c (OS2VMAN_bootstrap): add OS2_ShowMessageBox
- SDL_DirectFB_video.c (DirectFB_bootstrap): NULL ShowMessageBox
- SDL_naclvideo.c (NACL_bootstrap): NULL ShowMessageBox
(cherry picked from commit 9e352e61db)
This commit is contained in:
Ozkan Sezer 2024-01-23 04:11:20 +03:00
parent 10cbe04fc5
commit 52181848da
4 changed files with 12 additions and 6 deletions

View File

@ -4445,13 +4445,14 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
} else { } else {
/* It's completely fine to call this function before video is initialized */ /* It's completely fine to call this function before video is initialized */
const char *driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); const char *driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER);
int i;
if (driver_name && *driver_name != 0) { if (driver_name && *driver_name != 0) {
const char *driver_attempt = driver_name; const char *driver_attempt = driver_name;
while (driver_attempt && (*driver_attempt != 0) && (retval == -1)) { while (driver_attempt && (*driver_attempt != 0) && (retval == -1)) {
const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');
size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt) size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt)
: SDL_strlen(driver_attempt); : SDL_strlen(driver_attempt);
for (int i = 0; bootstrap[i]; ++i) { for (i = 0; bootstrap[i]; ++i) {
if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) && if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) { (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) { if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) {
@ -4464,7 +4465,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL; driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL;
} }
} else { } else {
for (int i = 0; bootstrap[i]; ++i) { for (i = 0; bootstrap[i]; ++i) {
if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) { if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0; retval = 0;
break; break;

View File

@ -65,7 +65,8 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void);
VideoBootStrap DirectFB_bootstrap = { VideoBootStrap DirectFB_bootstrap = {
"directfb", "DirectFB", "directfb", "DirectFB",
DirectFB_CreateDevice DirectFB_CreateDevice,
NULL /* no ShowMessageBox implementation */
}; };
static const DirectFBSurfaceDrawingFlagsNames(drawing_flags); static const DirectFBSurfaceDrawingFlagsNames(drawing_flags);

View File

@ -134,7 +134,8 @@ static SDL_VideoDevice *NACL_CreateDevice(void) {
VideoBootStrap NACL_bootstrap = { VideoBootStrap NACL_bootstrap = {
NACLVID_DRIVER_NAME, "SDL Native Client Video Driver", NACLVID_DRIVER_NAME, "SDL Native Client Video Driver",
NACL_CreateDevice NACL_CreateDevice,
NULL /* no ShowMessageBox implementation */
}; };
int NACL_VideoInit(_THIS) { int NACL_VideoInit(_THIS) {

View File

@ -31,6 +31,7 @@
#include "SDL_os2video.h" #include "SDL_os2video.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
#include "SDL_os2util.h" #include "SDL_os2util.h"
#include "SDL_os2messagebox.h"
#define __MEERROR_H__ #define __MEERROR_H__
#define _MEERROR_H_ #define _MEERROR_H_
@ -1683,12 +1684,14 @@ static SDL_VideoDevice *OS2VMAN_CreateDevice(void)
VideoBootStrap OS2DIVE_bootstrap = VideoBootStrap OS2DIVE_bootstrap =
{ {
OS2DRIVER_NAME_DIVE, "OS/2 video driver", OS2DRIVER_NAME_DIVE, "OS/2 video driver",
OS2DIVE_CreateDevice OS2DIVE_CreateDevice,
OS2_ShowMessageBox
}; };
VideoBootStrap OS2VMAN_bootstrap = VideoBootStrap OS2VMAN_bootstrap =
{ {
OS2DRIVER_NAME_VMAN, "OS/2 video driver", OS2DRIVER_NAME_VMAN, "OS/2 video driver",
OS2VMAN_CreateDevice OS2VMAN_CreateDevice,
OS2_ShowMessageBox
}; };
#endif /* SDL_VIDEO_DRIVER_OS2 */ #endif /* SDL_VIDEO_DRIVER_OS2 */