Fixed building on Windows with SDL_VIDEO=OFF Fixes https://github.com/libsdl-org/SDL/issues/6562
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index f64d554..ea2378b 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -24,6 +24,7 @@
#include "SDL_windows.h"
#include "SDL_error.h"
+#include "SDL_system.h"
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
#if defined(HAVE_ROAPI_H)
@@ -343,4 +344,54 @@ WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect)
#endif /* defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) */
+
+/*
+ * Public APIs
+ */
+#if !defined(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(int displayIndex)
+{
+ (void) displayIndex;
+ return 0; /* D3DADAPTER_DEFAULT */
+}
+
+SDL_bool
+SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
+{
+ (void) displayIndex;
+ if (adapterIndex) {
+ *adapterIndex = -1;
+ }
+ if (outputIndex) {
+ *outputIndex = -1;
+ }
+ return SDL_FALSE;
+}
+#endif /* __WIN32__ || __WINGDK__ */
+
+#endif /* !SDL_VIDEO_DRIVER_WINDOWS */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/haptic/windows/SDL_dinputhaptic.c b/src/haptic/windows/SDL_dinputhaptic.c
index a7900d6..4e06e20 100644
--- a/src/haptic/windows/SDL_dinputhaptic.c
+++ b/src/haptic/windows/SDL_dinputhaptic.c
@@ -37,7 +37,11 @@
/*
* External stuff.
*/
+#ifdef SDL_VIDEO_DRIVER_WINDOWS
extern HWND SDL_HelperWindow;
+#else
+static const HWND SDL_HelperWindow = NULL;
+#endif
/*
diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c
index 1b6cc94..7d1bd6d 100644
--- a/src/joystick/windows/SDL_dinputjoystick.c
+++ b/src/joystick/windows/SDL_dinputjoystick.c
@@ -42,7 +42,11 @@
#define CONVERT_MAGNITUDE(x) (((x)*10000) / 0x7FFF)
/* external variables referenced. */
+#ifdef SDL_VIDEO_DRIVER_WINDOWS
extern HWND SDL_HelperWindow;
+#else
+static const HWND SDL_HelperWindow = NULL;
+#endif
/* local variables */
static SDL_bool coinitialized = SDL_FALSE;