sdl12-compat: syswm: Deal with SDL2 versions from before the new SDL2 version scheme.

From 537a13f0345feed1d2587f91a41efcb6cc26a173 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 8 Sep 2022 10:48:54 -0400
Subject: [PATCH] syswm: Deal with SDL2 versions from before the new SDL2
 version scheme.

Fixes #168.
---
 src/SDL12_compat.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 1a2b35fe..1e460e8c 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -7019,7 +7019,18 @@ SDL_GetWMInfo(SDL12_SysWMinfo *info12)
     }
 
     SDL_zero(info20);
-    SDL_VERSION(&info20.version);
+
+    /* SDL2, before the version scheme change, would fail if the requested version wasn't
+       2.0.x, so if the SDL2 is from before this was fixed, we need to lie about the
+       version, and assume it will work out. */
+    if (LinkedSDL2VersionInt >= SDL_VERSIONNUM(2,24,0)) {
+        SDL_VERSION(&info20.version);
+    } else {
+        info20.version.major = 2;
+        info20.version.minor = 0;
+        info20.version.patch = 22;
+    }
+
     rc = SDL20_GetWindowWMInfo(win20, &info20);
 
     if (temp_window) {