|
@@ -4893,69 +4893,37 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
|
|
|
|
|
if (_this && _this->ShowMessageBox) {
|
|
|
retval = _this->ShowMessageBox(_this, messageboxdata, buttonid);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ /* It's completely fine to call this function before video is initialized */
|
|
|
+ const char *driver_name = SDL_GetHint(SDL_HINT_VIDEO_DRIVER);
|
|
|
+ if (driver_name && *driver_name != 0) {
|
|
|
+ const char *driver_attempt = driver_name;
|
|
|
+ while (driver_attempt && (*driver_attempt != 0) && (retval == -1)) {
|
|
|
+ const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');
|
|
|
+ size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt)
|
|
|
+ : SDL_strlen(driver_attempt);
|
|
|
+ for (int i = 0; bootstrap[i]; ++i) {
|
|
|
+ if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
|
|
+ (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
|
|
|
+ if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
+ retval = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- /* It's completely fine to call this function before video is initialized */
|
|
|
-#ifdef SDL_VIDEO_DRIVER_ANDROID
|
|
|
- if (retval == -1 &&
|
|
|
- Android_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
|
|
- if (retval == -1 &&
|
|
|
- WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_WINRT
|
|
|
- if (retval == -1 &&
|
|
|
- WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_COCOA
|
|
|
- if (retval == -1 &&
|
|
|
- Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_UIKIT
|
|
|
- if (retval == -1 &&
|
|
|
- UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
|
|
- if (retval == -1 &&
|
|
|
- Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_X11
|
|
|
- if (retval == -1 &&
|
|
|
- X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_HAIKU
|
|
|
- if (retval == -1 &&
|
|
|
- HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_RISCOS
|
|
|
- if (retval == -1 &&
|
|
|
- RISCOS_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
- }
|
|
|
-#endif
|
|
|
-#ifdef SDL_VIDEO_DRIVER_VITA
|
|
|
- if (retval == -1 &&
|
|
|
- VITA_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
- retval = 0;
|
|
|
+ driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (int i = 0; bootstrap[i]; ++i) {
|
|
|
+ if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) {
|
|
|
+ retval = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-#endif
|
|
|
+
|
|
|
if (retval == -1) {
|
|
|
const char *error = SDL_GetError();
|
|
|
|