From 10cbe04fc57be6c4328c745c64321977bab85eed Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 22 Jan 2024 18:04:14 -0500
Subject: [PATCH] SDL_ShowMessageBox: Remove `#ifdef`s and respect
SDL_VIDEO_DRIVER hint.
Fixes #8892.
(cherry picked from commit c5c0b2cb3447a9aecbb7c47622baa945ab43227b)
---
src/video/SDL_sysvideo.h | 1 +
src/video/SDL_video.c | 158 ++++-----------------
src/video/android/SDL_androidvideo.c | 4 +-
src/video/cocoa/SDL_cocoavideo.m | 4 +-
src/video/dummy/SDL_nullvideo.c | 6 +-
src/video/emscripten/SDL_emscriptenvideo.c | 3 +-
src/video/haiku/SDL_bvideo.cc | 4 +-
src/video/kmsdrm/SDL_kmsdrmvideo.c | 3 +-
src/video/n3ds/SDL_n3dsvideo.c | 2 +-
src/video/ngage/SDL_ngagevideo.cpp | 3 +-
src/video/offscreen/SDL_offscreenvideo.c | 3 +-
src/video/ps2/SDL_ps2video.c | 3 +-
src/video/psp/SDL_pspvideo.c | 3 +-
src/video/qnx/video.c | 3 +-
src/video/raspberry/SDL_rpivideo.c | 3 +-
src/video/riscos/SDL_riscosvideo.c | 4 +-
src/video/uikit/SDL_uikitvideo.m | 4 +-
src/video/vita/SDL_vitavideo.c | 4 +-
src/video/vivante/SDL_vivantevideo.c | 3 +-
src/video/wayland/SDL_waylandvideo.c | 4 +-
src/video/windows/SDL_windowsvideo.c | 8 +-
src/video/winrt/SDL_winrtmessagebox.cpp | 2 +-
src/video/winrt/SDL_winrtvideo.cpp | 7 +-
src/video/x11/SDL_x11video.c | 4 +-
24 files changed, 89 insertions(+), 154 deletions(-)
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 5542a0f6563c..7dfbe32715c6 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -451,6 +451,7 @@ typedef struct VideoBootStrap
const char *name;
const char *desc;
SDL_VideoDevice *(*create)(void);
+ int (*ShowMessageBox)(const SDL_MessageBoxData *messageboxdata, int *buttonid); /* can be done without initializing backend! */
} VideoBootStrap;
/* Not all of these are available in a given build. Use #ifdefs, etc. */
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index ed5aba2a6303..f18d4e988fdf 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -4401,59 +4401,6 @@ int SDL_GetMessageBoxCount(void)
return SDL_AtomicGet(&SDL_messagebox_count);
}
-#ifdef SDL_VIDEO_DRIVER_ANDROID
-#include "android/SDL_androidmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_WINDOWS
-#include "windows/SDL_windowsmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_WINRT
-#include "winrt/SDL_winrtmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_COCOA
-#include "cocoa/SDL_cocoamessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_UIKIT
-#include "uikit/SDL_uikitmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_X11
-#include "x11/SDL_x11messagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_WAYLAND
-#include "wayland/SDL_waylandmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_HAIKU
-#include "haiku/SDL_bmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_OS2
-#include "os2/SDL_os2messagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_RISCOS
-#include "riscos/SDL_riscosmessagebox.h"
-#endif
-#ifdef SDL_VIDEO_DRIVER_VITA
-#include "vita/SDL_vitamessagebox.h"
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) || defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT) || defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_HAIKU) || defined(SDL_VIDEO_DRIVER_OS2) || defined(SDL_VIDEO_DRIVER_RISCOS)
-static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
-{
- SDL_SysWMinfo info;
- SDL_Window *window = messageboxdata->window;
-
- if (!window) {
- return SDL_TRUE;
- }
-
- SDL_VERSION(&info.version);
- if (!SDL_GetWindowWMInfo(window, &info)) {
- return SDL_TRUE;
- } else {
- return (info.subsystem == drivertype);
- }
-}
-#endif
-
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
int dummybutton;
@@ -4495,84 +4442,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_VIDEODRIVER);
+ 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 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) &&
- WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_WINRT
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) &&
- WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_COCOA
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) &&
- Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_UIKIT
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) &&
- UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_X11
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) &&
- X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_WAYLAND
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) &&
- Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_HAIKU
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) &&
- HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_OS2
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) &&
- OS2_ShowMessageBox(messageboxdata, buttonid) == 0) {
- retval = 0;
- }
-#endif
-#ifdef SDL_VIDEO_DRIVER_RISCOS
- if (retval == -1 &&
- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) &&
- 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();
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index d4b257242929..f54b4c3cdd4d 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -41,6 +41,7 @@
#include "SDL_androidtouch.h"
#include "SDL_androidwindow.h"
#include "SDL_androidvulkan.h"
+#include "SDL_androidmessagebox.h"
#define ANDROID_VID_DRIVER_NAME "Android"
@@ -166,7 +167,8 @@ static SDL_VideoDevice *Android_CreateDevice(void)
VideoBootStrap Android_bootstrap = {
ANDROID_VID_DRIVER_NAME, "SDL Android video driver",
- Android_CreateDevice
+ Android_CreateDevice,
+ Android_ShowMessageBox
};
int Android_VideoInit(_THIS)
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index b4c5158165c3..156af8915072 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -33,6 +33,7 @@
#include "SDL_cocoavulkan.h"
#include "SDL_cocoametalview.h"
#include "SDL_cocoaopengles.h"
+#include "SDL_cocoamessagebox.h"
@implementation SDL_VideoData
@@ -179,7 +180,8 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device)
VideoBootStrap COCOA_bootstrap = {
"cocoa", "SDL Cocoa video driver",
- Cocoa_CreateDevice
+ Cocoa_CreateDevice,
+ Cocoa_ShowMessageBox
};
diff --git a/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c
index 55bb09d1e9c3..930e9891215e 100644
--- a/src/video/dummy/SDL_nullvideo.c
+++ b/src/video/dummy/SDL_nullvideo.c
@@ -120,13 +120,15 @@ static SDL_VideoDevice *DUMMY_CreateDevice(void)
VideoBootStrap DUMMY_bootstrap = {
DUMMYVID_DRIVER_NAME, "SDL dummy video driver",
- DUMMY_CreateDevice
+ DUMMY_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
#ifdef SDL_INPUT_LINUXEV
VideoBootStrap DUMMY_evdev_bootstrap = {
DUMMYVID_DRIVER_EVDEV_NAME, "SDL dummy video driver with evdev",
- DUMMY_CreateDevice
+ DUMMY_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
void SDL_EVDEV_Init(void);
void SDL_EVDEV_Poll();
diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c
index 8e1c3c6aa466..e713e5b77b1c 100644
--- a/src/video/emscripten/SDL_emscriptenvideo.c
+++ b/src/video/emscripten/SDL_emscriptenvideo.c
@@ -125,7 +125,8 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void)
VideoBootStrap Emscripten_bootstrap = {
EMSCRIPTENVID_DRIVER_NAME, "SDL emscripten video driver",
- Emscripten_CreateDevice
+ Emscripten_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
int Emscripten_VideoInit(_THIS)
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index 32bb2a45df92..aac091afc796 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -39,6 +39,7 @@ extern "C" {
#include "SDL_bmodes.h"
#include "SDL_bframebuffer.h"
#include "SDL_bevents.h"
+#include "SDL_bmessagebox.h"
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return (SDL_BWin *)(window->driverdata);
@@ -131,7 +132,8 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void)
VideoBootStrap HAIKU_bootstrap = {
"haiku", "Haiku graphics",
- HAIKU_CreateDevice
+ HAIKU_CreateDevice,
+ HAIKU_ShowMessageBox
};
void HAIKU_DeleteDevice(SDL_VideoDevice * device)
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 84c3af79f7d7..69033b0e7412 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -315,7 +315,8 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void)
VideoBootStrap KMSDRM_bootstrap = {
"KMSDRM",
"KMS/DRM Video Driver",
- KMSDRM_CreateDevice
+ KMSDRM_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
static void KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data)
diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c
index 0fa293cb0860..fc875d3ce520 100644
--- a/src/video/n3ds/SDL_n3dsvideo.c
+++ b/src/video/n3ds/SDL_n3dsvideo.c
@@ -86,7 +86,7 @@ static SDL_VideoDevice *N3DS_CreateDevice(void)
return device;
}
-VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS_CreateDevice };
+VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS_CreateDevice, NULL /* no ShowMessageBox implementation */ };
static int N3DS_VideoInit(_THIS)
{
diff --git a/src/video/ngage/SDL_ngagevideo.cpp b/src/video/ngage/SDL_ngagevideo.cpp
index 13a11bdf0724..d18abc8378a9 100644
--- a/src/video/ngage/SDL_ngagevideo.cpp
+++ b/src/video/ngage/SDL_ngagevideo.cpp
@@ -141,7 +141,8 @@ static SDL_VideoDevice *NGAGE_CreateDevice(void)
VideoBootStrap NGAGE_bootstrap = {
NGAGEVID_DRIVER_NAME, "SDL ngage video driver",
- NGAGE_CreateDevice
+ NGAGE_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
int NGAGE_VideoInit(_THIS)
diff --git a/src/video/offscreen/SDL_offscreenvideo.c b/src/video/offscreen/SDL_offscreenvideo.c
index 4d9e36053690..2d42374adb8e 100644
--- a/src/video/offscreen/SDL_offscreenvideo.c
+++ b/src/video/offscreen/SDL_offscreenvideo.c
@@ -95,7 +95,8 @@ static SDL_VideoDevice *OFFSCREEN_CreateDevice(void)
VideoBootStrap OFFSCREEN_bootstrap = {
OFFSCREENVID_DRIVER_NAME, "SDL offscreen video driver",
- OFFSCREEN_CreateDevice
+ OFFSCREEN_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
int OFFSCREEN_VideoInit(_THIS)
diff --git a/src/video/ps2/SDL_ps2video.c b/src/video/ps2/SDL_ps2video.c
index f6a3891420e9..4e823fe2dbb5 100644
--- a/src/video/ps2/SDL_ps2video.c
+++ b/src/video/ps2/SDL_ps2video.c
@@ -126,7 +126,8 @@ static SDL_VideoDevice *PS2_CreateDevice(void)
VideoBootStrap PS2_bootstrap = {
"PS2",
"PS2 Video Driver",
- PS2_CreateDevice
+ PS2_CreateDevice,
+ NULL /* no ShowMessageBox implementation */
};
#endif /* SDL_VIDEO_DRIVER_PS2 */
diff --git a/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c
index 8ac19e741c68..9631904bd135 100644
--- a/src/video/psp/SDL_pspvideo.c
+++ b/src/video/psp/SDL_pspvideo.c
@@ -134,7 +134,8 @@ static SDL_VideoDevice *PSP_Create()
VideoBootStrap PSP_bootstrap = {
"PSP",
"PSP Video Driver",
- PSP_Create
+ PSP_Create,
+ NULL /* no ShowMessageBox implementation */
};
/*****************************************************************************/
diff --git a/src/video/qnx/video.c b/src/video/qnx/video.c
index 621236b9e55c..924eaa3078de 100644
--- a/src/video/qnx/video.c
+++ b/src/video/qnx/video.c
@@ -342,5 +342,6 @@ static SDL_VideoDevice *createDevice(int devindex)
VideoBootStrap QNX_bootstrap = {
"qnx", "QNX Screen",
- createDevice
+ createDevice,
+ NULL /* no ShowMessageBox implementation */
};
diff --git a/src/video/raspberry/SDL_rpivideo.c b/src/video/raspberry/SDL_rpivideo.c
index 7574a84e9af3..1442607b1c91 100644
--- a/src/video/raspberry/SDL_rpivideo.c
+++ b/src/video/raspberry/SDL_rpivideo.c
@@ -138,7 +138,8 @@ static SDL_VideoDevice *RPI_Create()
VideoBootStrap RPI_bootstrap = {
"RPI",
"RPI Video Driver",
- RPI_Create
+ RPI_Create,
+ NULL /* no ShowMessageBox implementation */
};
/*****************************************************************************/
diff --git a/src/video/riscos/SDL_riscosvideo.c b/src/video/riscos/SDL_riscosvideo.c
index 8e755b8aefbb..1550139b702a 100644
--- a/src/video/riscos/SDL_riscosvideo.c
+++ b/src/video/riscos/SDL_riscosvideo.c
@@ -34,6 +34,7 @@
#include "SDL_riscosmouse.h"
#include "SDL_riscosmodes.h"
#include "SDL_riscoswindow.h"
+#include "SDL_riscosmessagebox.h"
#define RISCOSVID_DRIVER_NAME "riscos"
@@ -94,7 +95,8 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void)
VideoBootStrap RISCOS_bootstrap = {
RISCOSVID_DRIVER_NAME, "SDL RISC OS video driver",
- RISCOS_CreateDevice
+ RISCOS_CreateDevice,
+ RISCOS_ShowMessageBox
};
static int RISCOS_VideoInit(_THIS)
diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m
index b4f5982a60b0..f3257ea3f561 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -39,6 +39,7 @@
#include "SDL_uikitclipboard.h"
#include "SDL_uikitvulkan.h"
#include "SDL_uikitmetalview.h"
+#include "SDL_uikitmessagebox.h"
#define UIKITVID_DRIVER_NAME "uikit"
@@ -147,7 +148,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
VideoBootStrap UIKIT_bootstrap = {
UIKITVID_DRIVER_NAME, "SDL UIKit video driver",
- UIKit_CreateDevice
+ UIKit_CreateDevice,
+ UIKit_ShowMessageBox
};
diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index ee5c7a7267ce..9b8839d2c97f 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -39,6 +39,7 @@
#include "SDL_vitakeyboard.h"
#include "SDL_vitamouse_c.h"
#include "SDL_vitaframebuffer.h"
+#include "SDL_vitamessagebox.h"
#if defined(SDL_VIDEO_VITA_PIB)
#include "SDL_vitagles_c.h"
@@ -175,7 +176,8 @@ static SDL_VideoDevice *VITA_Create()
VideoBootStrap VITA_bootstrap = {
"VITA",
"VITA Video Driver",
- VITA_Create
+ VITA_Create,
+ VITA_ShowMessageBox
};
/*****************************************************************************/
diff --git a/src/video/vivante/SDL_vivantevideo.c b/src/video/vivante/SDL_vivantevideo.c
index 52a5b425dba7..a501f65b60b8 100644
--- a/src/video/vivante/SDL_vivantevideo.c
+++ b/src/video/vivante/SDL_vivantevideo.c
@@ -116,7 +116,8 @@ static SDL_VideoDevice *VIVANTE_Create()
VideoBootStrap VIVANTE_bootstrap = {
"vivante",
"Vivante EGL Video Driver",
- VIVANTE_Create
+ VIVANTE_Create,
+ NULL /* no ShowMessageBox implementation */
};
/*****************************************************************************/
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index cbbb0bb76923..2cae471792cd 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -37,6 +37,7 @@
#include "SDL_waylandtouch.h"
#include "SDL_waylandclipboard.h"
#include "SDL_waylandvulkan.h"
+#include "SDL_waylandmessagebox.h"
#include "SDL_hints.h"
#include <sys/types.h>
@@ -307,7 +308,8 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
VideoBootStrap Wayland_bootstrap = {
WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver",
- Wayland_CreateDevice
+ Wayland_CreateDevice,
+ Wayland_ShowMessageBox
};
static void xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output,
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 798acb1b325d..5f1902aae3ef 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -35,6 +35,7 @@
#include "SDL_windowsframebuffer.h"
#include "SDL_windowsshape.h"
#include "SDL_windowsvulkan.h"
+#include "SDL_windowsmessagebox.h"
/* #define HIGHDPI_DEBUG */
@@ -262,7 +263,12 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
}
VideoBootStrap WINDOWS_bootstrap = {
- "windows", "SDL Windows video driver", WIN_CreateDevice
+ "windows", "SDL Windows video driver", WIN_CreateDevice,
+ #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
+ WIN_ShowMessageBox
+ #else
+ NULL
+ #endif
};
static BOOL WIN_DeclareDPIAwareUnaware(_THIS)
diff --git a/src/video/winrt/SDL_winrtmessagebox.cpp b/src/video/winrt/SDL_winrtmessagebox.cpp
index 7d7f5a4e1c33..a2d66a3c4ff7 100644
--- a/src/video/winrt/SDL_winrtmessagebox.cpp
+++ b/src/video/winrt/SDL_winrtmessagebox.cpp
@@ -41,7 +41,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) {
return rtstr;
}
- extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION == NTDDI_WIN8)
/* Sadly, Windows Phone 8 doesn't include the MessageDialog class that
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index 659f78705250..e3365b1db3ab 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -61,6 +61,7 @@ extern "C" {
#include "SDL_syswm.h"
#include "SDL_winrtopengles.h"
#include "../../core/windows/SDL_windows.h"
+#include "SDL_winrtmessagebox.h"
}
#include "../../core/winrt/SDL_winrtapp_direct3d.h"
@@ -166,10 +167,10 @@ static SDL_VideoDevice *WINRT_CreateDevice(void)
return device;
}
-#define WINRTVID_DRIVER_NAME "winrt"
VideoBootStrap WINRT_bootstrap = {
- WINRTVID_DRIVER_NAME, "SDL WinRT video driver",
- WINRT_CreateDevice
+ "winrt", "SDL WinRT video driver",
+ WINRT_CreateDevice,
+ WINRT_ShowMessageBox
};
static void SDLCALL WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index 5f283ce0678f..a9d7abe95d74 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -37,6 +37,7 @@
#include "SDL_x11touch.h"
#include "SDL_x11xinput2.h"
#include "SDL_x11xfixes.h"
+#include "SDL_x11messagebox.h"
#ifdef SDL_VIDEO_OPENGL_EGL
#include "SDL_x11opengles.h"
@@ -326,7 +327,8 @@ static SDL_VideoDevice *X11_CreateDevice(void)
VideoBootStrap X11_bootstrap = {
"x11", "SDL X11 video driver",
- X11_CreateDevice
+ X11_CreateDevice,
+ X11_ShowMessageBox
};
static int (*handler)(Display *, XErrorEvent *) = NULL;