SDL: Fixed building with the video subsystem disabled

From a0967c017fff51d60dcc4571adfefc3d99f2e0f4 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 17 Jan 2024 07:41:48 -0800
Subject: [PATCH] Fixed building with the video subsystem disabled

---
 src/core/windows/SDL_windows.c    | 45 -------------------------------
 src/video/SDL_video_unsupported.c | 43 +++++++++++++++++++----------
 2 files changed, 29 insertions(+), 59 deletions(-)

diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index 0e6b474e06e0..f6f679bd6da1 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -436,48 +436,3 @@ DECLSPEC int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char* _argv[], SDL_main_fu
 #endif /* __WIN32__ */
 
 #endif /* defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) */
-
-/*
- * Public APIs
- */
-#ifndef SDL_VIDEO_DRIVER_WINDOWS
-
-#if defined(__WIN32__) || defined(__GDK__)
-int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
-{
-    (void)name;
-    (void)style;
-    (void)hInst;
-    return 0;
-}
-
-void SDL_UnregisterApp(void)
-{
-}
-
-void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
-{
-}
-#endif /* __WIN32__ || __GDK__ */
-
-#if defined(__WIN32__) || defined(__WINGDK__)
-int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID)
-{
-    (void)displayID;
-    return 0; /* D3DADAPTER_DEFAULT */
-}
-
-SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex)
-{
-    (void)displayID;
-    if (adapterIndex) {
-        *adapterIndex = -1;
-    }
-    if (outputIndex) {
-        *outputIndex = -1;
-    }
-    return SDL_FALSE;
-}
-#endif /* __WIN32__ || __WINGDK__ */
-
-#endif /* !SDL_VIDEO_DRIVER_WINDOWS */
diff --git a/src/video/SDL_video_unsupported.c b/src/video/SDL_video_unsupported.c
index 0731f038038b..e070f40ee03b 100644
--- a/src/video/SDL_video_unsupported.c
+++ b/src/video/SDL_video_unsupported.c
@@ -22,7 +22,26 @@
 
 #ifndef SDL_VIDEO_DRIVER_WINDOWS
 
-DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
+#if defined(__WIN32__) || defined(__GDK__)
+
+int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
+{
+    (void)name;
+    (void)style;
+    (void)hInst;
+    return 0;
+}
+
+void SDL_UnregisterApp(void)
+{
+}
+
+void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
+{
+}
+
+#endif /* __WIN32__ || __GDK__ */
+
 SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex)
 {
     (void)displayID;
@@ -32,18 +51,24 @@ SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *
     return SDL_FALSE;
 }
 
-DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID);
 int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID)
 {
     (void)displayID;
     return SDL_Unsupported();
 }
 
-#endif
+#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
+
+int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID)
+{
+    (void)displayID;
+    return SDL_Unsupported();
+}
+
+#endif /* !SDL_VIDEO_DRIVER_WINDOWS */
 
 #ifndef __GDK__
 
-DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(void *outTaskQueue);
 int SDL_GDKGetTaskQueue(void *outTaskQueue)
 {
     (void)outTaskQueue;
@@ -54,7 +79,6 @@ int SDL_GDKGetTaskQueue(void *outTaskQueue)
 
 #ifndef SDL_VIDEO_DRIVER_UIKIT
 
-DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
 void SDL_OnApplicationDidChangeStatusBarOrientation(void)
 {
     SDL_Unsupported();
@@ -64,7 +88,6 @@ void SDL_OnApplicationDidChangeStatusBarOrientation(void)
 
 #ifndef SDL_VIDEO_DRIVER_UIKIT
 
-DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam);
 int SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
 {
     (void)window;
@@ -74,7 +97,6 @@ int SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*call
     return SDL_Unsupported();
 }
 
-DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
 void SDL_iPhoneSetEventPump(SDL_bool enabled)
 {
     (void)enabled;
@@ -82,10 +104,3 @@ void SDL_iPhoneSetEventPump(SDL_bool enabled)
 }
 #endif
 
-#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
-int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID)
-{
-    (void)displayID;
-    return SDL_Unsupported();
-}
-#endif