sdl12-compat: testwm: More robust SDL12COMPAT_GetWindow() testing.

From 557bb05398d5508c2f899c0774e2240a71ae5f58 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 10 Oct 2022 13:52:10 -0400
Subject: [PATCH] testwm: More robust SDL12COMPAT_GetWindow() testing.

---
 test/testwm.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/testwm.c b/test/testwm.c
index ced2981d8..16f29bfa5 100644
--- a/test/testwm.c
+++ b/test/testwm.c
@@ -348,7 +348,6 @@ int SDLCALL FilterEvents(const SDL_Event *event)
 	}
 }
 
-
 static char testtitle[] = "Testing  1.. 2.. 3...";
 
 int main(int argc, char *argv[])
@@ -458,10 +457,17 @@ int main(int argc, char *argv[])
 			printf("Generic syswm info: data=%X\n", syswm_info.data);
 			#endif
 		}
-#if SDL_COMPILEDVERSION >= SDL_VERSIONNUM(1, 2, 54)
-		printf("SDL 2.0 window: %p\n", SDL12COMPAT_GetWindow());
-#endif
 	}
+
+	{
+		typedef SDL_Window * SDLCALL (*fnSDL12COMPAT_GetWindow)(void);
+		fnSDL12COMPAT_GetWindow pfnSDL12COMPAT_GetWindow = (fnSDL12COMPAT_GetWindow) SDL_GL_GetProcAddress("SDL12COMPAT_GetWindow");
+		printf("SDL12COMPAT_GetWindow address is %p%s\n", pfnSDL12COMPAT_GetWindow, pfnSDL12COMPAT_GetWindow ? "" : " (probably using classic SDL 1.2)");
+		if (pfnSDL12COMPAT_GetWindow != NULL) {
+			printf("SDL 2.0 window: %p\n", pfnSDL12COMPAT_GetWindow());
+		}
+	}
+
 	SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
 #endif