SDL: Renamed SDL_HasWindowSurface to SDL_WindowHasSurface

From f95b7ee4da8f6e31fef63d1510053b00d392e4ac Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 9 Feb 2024 16:46:58 -0800
Subject: [PATCH] Renamed SDL_HasWindowSurface to SDL_WindowHasSurface

Fixes https://github.com/libsdl-org/SDL/issues/9034
---
 build-scripts/SDL_migration.cocci | 5 +++++
 docs/README-migration.md          | 1 +
 include/SDL3/SDL_oldnames.h       | 2 ++
 include/SDL3/SDL_video.h          | 6 +++---
 src/dynapi/SDL_dynapi.sym         | 2 +-
 src/dynapi/SDL_dynapi_overrides.h | 2 +-
 src/dynapi/SDL_dynapi_procs.h     | 2 +-
 src/render/SDL_render.c           | 2 +-
 src/video/SDL_video.c             | 2 +-
 9 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index 9b732532f7bc..bf036c1cdf78 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -2904,3 +2904,8 @@ expression e1, e2, e3, e4;
 - SDL_threadID
 + SDL_ThreadID
   (...)
+@@
+@@
+- SDL_HasWindowSurface
++ SDL_WindowHasSurface
+  (...)
diff --git a/docs/README-migration.md b/docs/README-migration.md
index da7a7bda8c0e..ffe3e761db77 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -1626,6 +1626,7 @@ The following functions have been renamed:
 * SDL_GetRectDisplayIndex() => SDL_GetDisplayForRect()
 * SDL_GetWindowDisplayIndex() => SDL_GetDisplayForWindow()
 * SDL_GetWindowDisplayMode() => SDL_GetWindowFullscreenMode()
+* SDL_HasWindowSurface() => SDL_WindowHasSurface()
 * SDL_IsScreenSaverEnabled() => SDL_ScreenSaverEnabled()
 * SDL_SetWindowDisplayMode() => SDL_SetWindowFullscreenMode()
 
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index 0a7a47cae53d..a5aaf1148329 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -499,6 +499,7 @@
 #define SDL_GetRectDisplayIndex SDL_GetDisplayForRect
 #define SDL_GetWindowDisplayIndex SDL_GetDisplayForWindow
 #define SDL_GetWindowDisplayMode SDL_GetWindowFullscreenMode
+#define SDL_HasWindowSurface SDL_WindowHasSurface
 #define SDL_IsScreenSaverEnabled SDL_ScreenSaverEnabled
 #define SDL_SetWindowDisplayMode SDL_SetWindowFullscreenMode
 #define SDL_WINDOW_ALLOW_HIGHDPI SDL_WINDOW_HIGH_PIXEL_DENSITY
@@ -967,6 +968,7 @@
 #define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayForRect
 #define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_renamed_SDL_GetDisplayForWindow
 #define SDL_GetWindowDisplayMode SDL_GetWindowDisplayMode_renamed_SDL_GetWindowFullscreenMode
+#define SDL_HasWindowSurface SDL_HasWindowSurface_renamed_SDL_WindowHasSurface
 #define SDL_IsScreenSaverEnabled SDL_IsScreenSaverEnabled_renamed_SDL_ScreenSaverEnabled
 #define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_renamed_SDL_SetWindowFullscreenMode
 #define SDL_WINDOW_ALLOW_HIGHDPI SDL_WINDOW_ALLOW_HIGHDPI_renamed_SDL_WINDOW_HIGH_PIXEL_DENSITY
diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h
index bd290fc96f48..57cf51d4760d 100644
--- a/include/SDL3/SDL_video.h
+++ b/include/SDL3/SDL_video.h
@@ -1699,7 +1699,7 @@ extern DECLSPEC int SDLCALL SDL_SyncWindow(SDL_Window *window);
  *
  * \sa SDL_GetWindowSurface
  */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasWindowSurface(SDL_Window *window);
+extern DECLSPEC SDL_bool SDLCALL SDL_WindowHasSurface(SDL_Window *window);
 
 /**
  * Get the SDL surface associated with the window.
@@ -1722,7 +1722,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasWindowSurface(SDL_Window *window);
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_DestroyWindowSurface
- * \sa SDL_HasWindowSurface
+ * \sa SDL_WindowHasSurface
  * \sa SDL_UpdateWindowSurface
  * \sa SDL_UpdateWindowSurfaceRects
  */
@@ -1784,7 +1784,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, con
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowSurface
- * \sa SDL_HasWindowSurface
+ * \sa SDL_WindowHasSurface
  */
 extern DECLSPEC int SDLCALL SDL_DestroyWindowSurface(SDL_Window *window);
 
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index b4dca5f46c10..2ba1f7be6a87 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -393,7 +393,7 @@ SDL3_0.0.0 {
     SDL_HasSSE42;
     SDL_HasSSE;
     SDL_HasScreenKeyboardSupport;
-    SDL_HasWindowSurface;
+    SDL_WindowHasSurface;
     SDL_HideCursor;
     SDL_HideWindow;
     SDL_Init;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 341add8cdcd8..b297a3026ecf 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -417,7 +417,7 @@
 #define SDL_HasSSE41 SDL_HasSSE41_REAL
 #define SDL_HasSSE42 SDL_HasSSE42_REAL
 #define SDL_HasScreenKeyboardSupport SDL_HasScreenKeyboardSupport_REAL
-#define SDL_HasWindowSurface SDL_HasWindowSurface_REAL
+#define SDL_WindowHasSurface SDL_WindowHasSurface_REAL
 #define SDL_HideCursor SDL_HideCursor_REAL
 #define SDL_HideWindow SDL_HideWindow_REAL
 #define SDL_Init SDL_Init_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index a276a7e97438..e8a4e188dbfe 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -476,7 +476,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE3,(void),(),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE41,(void),(),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE42,(void),(),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return)
-SDL_DYNAPI_PROC(SDL_bool,SDL_HasWindowSurface,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_WindowHasSurface,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_HideCursor,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_HideWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_Init,(Uint32 a),(a),return)
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index d10e1e3c3fef..173a3237307a 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -899,7 +899,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
         goto error;
     }
 
-    if (SDL_HasWindowSurface(window)) {
+    if (SDL_WindowHasSurface(window)) {
         SDL_SetError("Surface already associated with window");
         goto error;
     }
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index cbc6b29e1d00..f568e3cf47ef 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3119,7 +3119,7 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window)
     return SDL_CreateSurfaceFrom(pixels, w, h, pitch, format);
 }
 
-SDL_bool SDL_HasWindowSurface(SDL_Window *window)
+SDL_bool SDL_WindowHasSurface(SDL_Window *window)
 {
     CHECK_WINDOW_MAGIC(window, SDL_FALSE);