sdl2-compat: video: Fixed SDL_WINDOW_ALWAYS_ON_TOP.

From 790769ada3af6383e66a3afad83e27b802b96e97 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 3 Feb 2025 20:01:42 -0500
Subject: [PATCH] video: Fixed SDL_WINDOW_ALWAYS_ON_TOP.

Reference Issue #303.
---
 src/sdl2_compat.c | 6 ++++++
 src/sdl2_compat.h | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index b55b457..a7c9ca4 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -7299,6 +7299,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
         flags |= SDL_WINDOW_UTILITY;
     }
 
+    /* whoops, this changed values in SDL3. */
+    if (flags & SDL2_WINDOW_ALWAYS_ON_TOP) {
+        flags &= ~SDL2_WINDOW_ALWAYS_ON_TOP;
+        flags |= SDL_WINDOW_ALWAYS_ON_TOP;
+    }
+
     if (!is_popup) {
         SDL_PropertiesID props = SDL3_CreateProperties();
 
diff --git a/src/sdl2_compat.h b/src/sdl2_compat.h
index 606fcce..3333123 100644
--- a/src/sdl2_compat.h
+++ b/src/sdl2_compat.h
@@ -44,6 +44,9 @@ typedef enum
 #define SDL2_WINDOW_FULLSCREEN_DESKTOP (0x00001000 | SDL_WINDOW_FULLSCREEN)
 #define SDL2_WINDOW_SKIP_TASKBAR 0x00010000
 
+/* has a different bit set for SDL3. */
+#define SDL2_WINDOW_ALWAYS_ON_TOP 0x00008000
+
 /* removed in SDL3 (APIs like this were split into getter/setter functions). */
 #define SDL2_QUERY   -1
 #define SDL2_DISABLE  0