sdl12-compat: version requirement clarifications:

From a98590a0d9176806b4f21fe2fbb35107b427cf67 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 10 Sep 2021 01:11:20 +0300
Subject: [PATCH] version requirement clarifications:

It appears that headers from SDL2 >= 2.0.7 are needed for SDL_AudioStream
in order to build. At runtime, 2.0.9 or newer needed (2.0.12+ for windows
because of an SDL_Thread compatibility issue.) Documented these.

Moved SDL2 version check from SDL12_compat.c to SDL20_include_wrapper.h
and bumped its minimum requirement from 2.0.0 to 2.0.7.

Removed use of SDL_FPoint struct, so that we can compile against versions
as old as 2.0.7.

Closes: https://github.com/libsdl-org/sdl12-compat/issues/131
---
 README.md                   | 8 ++++----
 src/SDL12_compat.c          | 8 +++-----
 src/SDL20_include_wrapper.h | 6 ++++++
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 88b677d..ccf21ca 100644
--- a/README.md
+++ b/README.md
@@ -18,13 +18,14 @@ that.
 
 # How to use:
 
-- Build the library. This will need access to SDL2's headers,
+- Build the library. This will need access to SDL2's headers (v2.0.7 or newer),
 [CMake](https://cmake.org/) and the build tools of your choice. Once built, you
 will have a drop-in replacement that can be used with any existing binary
 that relies on SDL 1.2. You can copy this library over the existing 1.2 build,
 or force it to take priority over a system copy with LD_LIBRARY_PATH, etc.
-At runtime, sdl12-compat needs to be able to find a copy of SDL2, so plan to
-include it with the library if necessary.
+At runtime, sdl12-compat needs to be able to find a copy of SDL2 (v2.0.9 or
+newer -- v2.0.12 or newer for Windows), so plan to include it with the library
+if necessary.
 
 - If you want to build an SDL 1.2 program from source code, we have included
 compatibility headers, so that sdl12-compat can completely replace SDL 1.2
@@ -33,4 +34,3 @@ compatibility and don't have a lot of documentation or fanciness at all. The
 new headers are also under the zlib license. Note that sdl12-compat itself
 does not use these headers, so if you just want the library, you don't need
 them.
-
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 9331d4c..d55f192 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -23,10 +23,6 @@
 
 #include "SDL20_include_wrapper.h"
 
-#if !SDL_VERSION_ATLEAST(2,0,0)
-#error You need to compile against SDL 2.0 headers.
-#endif
-
 /*
  * We report the library version as 1.2.$(SDL12_COMPAT_VERSION). This number
  *  should be way ahead of what SDL-1.2 Classic would report, so apps can
@@ -940,7 +936,9 @@ static JoystickOpenedItem JoystickOpenList[16];
 static Uint8 KeyState[SDLK12_LAST];
 static SDL_bool MouseInputIsRelative = SDL_FALSE;
 static SDL_Point MousePosition = { 0, 0 };
-static SDL_FPoint MouseRelativeRemainder = { 0.f, 0.f };
+static struct { /* SDL_FPoint */
+    float x, y;
+} MouseRelativeRemainder = { 0.f, 0.f };
 static SDL_bool UseMouseRelativeScaling = SDL_FALSE;
 static OpenGLEntryPoints OpenGLFuncs;
 static int OpenGLBlitLockCount = 0;
diff --git a/src/SDL20_include_wrapper.h b/src/SDL20_include_wrapper.h
index 5316cda..cfd1d84 100644
--- a/src/SDL20_include_wrapper.h
+++ b/src/SDL20_include_wrapper.h
@@ -116,6 +116,12 @@
 #include "SDL.h"
 #include "SDL_syswm.h"    /* includes windows.h for _WIN32, os2.h for __OS2__ */
 
+/* Headers from SDL2 >= 2.0.7 needed for SDL_AudioStream:
+ */
+#if !SDL_VERSION_ATLEAST(2,0,7)
+#error You need to compile against SDL >= 2.0.7 headers.
+#endif
+
 /* Missing SDL_thread.h stuff (see above): */
 #if defined(_WIN32) || defined(__OS2__)
 typedef struct SDL_Thread SDL_Thread;