sdl12-compat: syswm: The magic SDL_SysWMinfo2on12 hack reports the `SDL_Window *` now, too.

From f0199bdb25e2a1483eee7a3dccb95565323dd0b4 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 8 Sep 2022 10:55:42 -0400
Subject: [PATCH] syswm: The magic SDL_SysWMinfo2on12 hack reports the
 `SDL_Window *` now, too.

Fixes #186.
---
 include/SDL/SDL_syswm.h | 1 +
 src/SDL12_compat.c      | 2 ++
 test/testsyswm2on12.c   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/include/SDL/SDL_syswm.h b/include/SDL/SDL_syswm.h
index 2add7d9b..80865d1a 100644
--- a/include/SDL/SDL_syswm.h
+++ b/include/SDL/SDL_syswm.h
@@ -134,6 +134,7 @@ typedef struct SDL_SysWMinfo2on12
     void *data6;
     void *data7;
     void *data8;
+    void *sdl2_window;  /* this is the SDL2 SDL_Window */
 } SDL_SysWMinfo2on12;
 
 extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 1e460e8c..20b5f9da 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -650,6 +650,7 @@ typedef struct SDL12_SysWMinfo2on12
     void *data6;
     void *data7;
     void *data8;
+    void *sdl2_window;
 } SDL12_SysWMinfo2on12;
 
 
@@ -7047,6 +7048,7 @@ SDL_GetWMInfo(SDL12_SysWMinfo *info12)
         SDL_zerop(wminfo2);
         SDL20_memcpy(&wminfo2->version, &info20.version, sizeof (wminfo2->version));
         wminfo2->subsystem = (Uint32) info20.subsystem;  /* these do not map to SDL 1.2 values! You're on your own! */
+        wminfo2->sdl2_window = VideoWindow20;
 
         switch (info20.subsystem) {
             #if defined(SDL_VIDEO_DRIVER_WINDOWS)
diff --git a/test/testsyswm2on12.c b/test/testsyswm2on12.c
index 73b000df..ee2ffa09 100644
--- a/test/testsyswm2on12.c
+++ b/test/testsyswm2on12.c
@@ -105,6 +105,7 @@ int main(int argc, char **argv)
         printf("data6: %p\n", syswm_info.data6);
         printf("data7: %p\n", syswm_info.data7);
         printf("data8: %p\n", syswm_info.data8);
+        printf("sdl2_window: %p\n", syswm_info.sdl2_window);
     }
 
     SDL_Quit();