SDL: ios: Renamed APIs that referred to "iPhone" to refer to "iOS".

From 6e1ed94913ea28cb223a4c3c7689a03d616ae5e4 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 13 Apr 2024 14:30:30 -0400
Subject: [PATCH] ios: Renamed APIs that referred to "iPhone" to refer to
 "iOS".

Macros that papered over this difference in SDL2 have been removed for SDL3.

Fixes #9527.
---
 build-scripts/SDL_migration.cocci      | 10 ++++++++++
 docs/README-ios.md                     |  4 ++--
 docs/README-migration.md               |  5 +++++
 include/SDL3/SDL_oldnames.h            |  4 ++++
 include/SDL3/SDL_system.h              | 20 +++++---------------
 src/dynapi/SDL_dynapi.sym              |  4 ++--
 src/dynapi/SDL_dynapi_overrides.h      |  4 ++--
 src/dynapi/SDL_dynapi_procs.h          |  4 ++--
 src/video/SDL_video_unsupported.c      |  8 ++++----
 src/video/uikit/SDL_uikitappdelegate.m |  4 ++--
 src/video/uikit/SDL_uikitevents.m      |  2 +-
 src/video/uikit/SDL_uikitwindow.m      |  2 +-
 12 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index e24f31fb47ba0..d88603cfdde55 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -3134,3 +3134,13 @@ typedef SDL_Colour, SDL_Color;
 - SDL_WinRTGetFSPathUTF8
 + SDL_WinRTGetFSPath
   (...)
+@@
+@@
+- SDL_iPhoneSetAnimationCallback
++ SDL_iOSSetAnimationCallback
+  (...)
+@@
+@@
+- SDL_iPhoneSetEventPump
++ SDL_iOSSetEventPump
+  (...)
diff --git a/docs/README-ios.md b/docs/README-ios.md
index ff991ad00bf74..2080f7bc680bb 100644
--- a/docs/README-ios.md
+++ b/docs/README-ios.md
@@ -222,7 +222,7 @@ Game Center
 
 Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
 
-    int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+    int SDL_iOSSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
 
 This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
 
@@ -244,7 +244,7 @@ e.g.
 
         // Set up the game to run in the window animation callback on iOS
         // so that Game Center and so forth works correctly.
-        SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
+        SDL_iOSSetAnimationCallback(window, 1, ShowFrame, NULL);
     #else
         while ( running ) {
             ShowFrame(0);
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 29c6ca37b1502..4652a956835a7 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -1490,6 +1490,9 @@ SDL_AndroidGetExternalStorageState() takes the state as an output parameter and
 
 SDL_AndroidRequestPermission is no longer a blocking call; the caller now provides a callback function that fires when a response is available.
 
+SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() have been renamed to SDL_iOSSetAnimationCallback() and SDL_iOSSetEventPump(), respectively. SDL2 has had macros to provide this new name with the old symbol since the introduction of the iPad, but now the correctly-named symbol is the only option.
+
+
 The following functions have been removed:
 * SDL_RenderGetD3D11Device() - replaced with the "SDL.renderer.d3d11.device" property
 * SDL_RenderGetD3D12Device() - replaced with the "SDL.renderer.d3d12.device" property
@@ -1498,6 +1501,8 @@ The following functions have been removed:
 
 The following functions have been renamed:
 * SDL_WinRTGetFSPathUTF8() => SDL_WinRTGetFSPath()
+* SDL_iPhoneSetAnimationCallback() => SDL_iOSSetAnimationCallback()
+* SDL_iPhoneSetEventPump() => SDL_iOSSetEventPump()
 
 ## SDL_syswm.h
 
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index 4da32c1c8add4..5be38ef9d94a3 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -513,6 +513,8 @@
 
 /* ##SDL_system.h */
 #define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPath
+#define SDL_iPhoneSetAnimationCallback SDL_iOSSetAnimationCallback
+#define SDL_iPhoneSetEventPump SDL_iOSSetEventPump
 
 /* ##SDL_thread.h */
 #define SDL_TLSCleanup SDL_CleanupTLS
@@ -1017,6 +1019,8 @@
 
 /* ##SDL_system.h */
 #define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_renamed_SDL_WinRTGetFSPath
+#define SDL_iPhoneSetAnimationCallback SDL_iPhoneSetAnimationCallback_renamed_SDL_iOSSetAnimationCallback
+#define SDL_iPhoneSetEventPump SDL_iPhoneSetEventPump_renamed_SDL_iOSSetEventPump
 
 /* ##SDL_thread.h */
 #define SDL_TLSCleanup SDL_TLSCleanup_renamed_SDL_CleanupTLS
diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h
index b6976ea746fd9..a684d07708776 100644
--- a/include/SDL3/SDL_system.h
+++ b/include/SDL3/SDL_system.h
@@ -164,8 +164,6 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
  */
 #ifdef SDL_PLATFORM_IOS
 
-#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
-
 /**
  * Use this function to set the animation callback on Apple iOS.
  *
@@ -176,16 +174,13 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
  * ```
  *
  * Where its parameter, `callbackParam`, is what was passed as `callbackParam`
- * to SDL_iPhoneSetAnimationCallback().
+ * to SDL_iOSSetAnimationCallback().
  *
  * This function is only available on Apple iOS.
  *
  * For more information see:
  * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md
  *
- * This functions is also accessible using the macro
- * SDL_iOSSetAnimationCallback() since SDL 2.0.4.
- *
  * \param window the window for which the animation callback should be set
  * \param interval the number of frames after which **callback** will be
  *                 called
@@ -196,27 +191,22 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
  *
  * \since This function is available since SDL 3.0.0.
  *
- * \sa SDL_iPhoneSetEventPump
+ * \sa SDL_iOSSetEventPump
  */
-extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
-
-#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
+extern DECLSPEC int SDLCALL SDL_iOSSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
 
 /**
  * Use this function to enable or disable the SDL event pump on Apple iOS.
  *
  * This function is only available on Apple iOS.
  *
- * This functions is also accessible using the macro SDL_iOSSetEventPump()
- * since SDL 2.0.4.
- *
  * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it
  *
  * \since This function is available since SDL 3.0.0.
  *
- * \sa SDL_iPhoneSetAnimationCallback
+ * \sa SDL_iOSSetAnimationCallback
  */
-extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
+extern DECLSPEC void SDLCALL SDL_iOSSetEventPump(SDL_bool enabled);
 
 #endif /* SDL_PLATFORM_IOS */
 
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 2e9b6d0963869..802f6954d4304 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -911,8 +911,8 @@ SDL3_0.0.0 {
     SDL_hid_send_feature_report;
     SDL_hid_set_nonblocking;
     SDL_hid_write;
-    SDL_iPhoneSetAnimationCallback;
-    SDL_iPhoneSetEventPump;
+    SDL_iOSSetAnimationCallback;
+    SDL_iOSSetEventPump;
     SDL_iconv;
     SDL_iconv_close;
     SDL_iconv_open;
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 7b1ffe0828e1f..c45e30b7effa6 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -935,8 +935,8 @@
 #define SDL_hid_send_feature_report SDL_hid_send_feature_report_REAL
 #define SDL_hid_set_nonblocking SDL_hid_set_nonblocking_REAL
 #define SDL_hid_write SDL_hid_write_REAL
-#define SDL_iPhoneSetAnimationCallback  SDL_iPhoneSetAnimationCallback_REAL
-#define SDL_iPhoneSetEventPump  SDL_iPhoneSetEventPump_REAL
+#define SDL_iOSSetAnimationCallback  SDL_iOSSetAnimationCallback_REAL
+#define SDL_iOSSetEventPump  SDL_iOSSetEventPump_REAL
 #define SDL_iconv SDL_iconv_REAL
 #define SDL_iconv_close SDL_iconv_close_REAL
 #define SDL_iconv_open SDL_iconv_open_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index bde24c188bcd2..64e7d72a01afa 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -954,8 +954,8 @@ SDL_DYNAPI_PROC(int,SDL_hid_read_timeout,(SDL_hid_device *a, unsigned char *b, s
 SDL_DYNAPI_PROC(int,SDL_hid_send_feature_report,(SDL_hid_device *a, const unsigned char *b, size_t c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_hid_set_nonblocking,(SDL_hid_device *a, int b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_hid_write,(SDL_hid_device *a, const unsigned char *b, size_t c),(a,b,c),return)
-SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void *), void *d),(a,b,c,d),return)
-SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),)
+SDL_DYNAPI_PROC(int,SDL_iOSSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void *), void *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(void,SDL_iOSSetEventPump,(SDL_bool a),(a),)
 SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return)
 SDL_DYNAPI_PROC(SDL_iconv_t,SDL_iconv_open,(const char *a, const char *b),(a,b),return)
diff --git a/src/video/SDL_video_unsupported.c b/src/video/SDL_video_unsupported.c
index e7a986ee6d33c..93d966925464a 100644
--- a/src/video/SDL_video_unsupported.c
+++ b/src/video/SDL_video_unsupported.c
@@ -93,8 +93,8 @@ void SDL_OnApplicationDidChangeStatusBarOrientation(void)
 
 #ifndef SDL_VIDEO_DRIVER_UIKIT
 
-DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam);
-int SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
+DECLSPEC int SDLCALL SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam);
+int SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
 {
     (void)window;
     (void)interval;
@@ -103,8 +103,8 @@ int SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*call
     return SDL_Unsupported();
 }
 
-DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
-void SDL_iPhoneSetEventPump(SDL_bool enabled)
+DECLSPEC void SDLCALL SDL_iOSSetEventPump(SDL_bool enabled);
+void SDL_iOSSetEventPump(SDL_bool enabled)
 {
     (void)enabled;
     SDL_Unsupported();
diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m
index 914c27a8b8ae5..35f697d599241 100644
--- a/src/video/uikit/SDL_uikitappdelegate.m
+++ b/src/video/uikit/SDL_uikitappdelegate.m
@@ -404,9 +404,9 @@ - (void)postFinishLaunch
     [self performSelector:@selector(hideLaunchScreen) withObject:nil afterDelay:0.0];
 
     /* run the user's application, passing argc and argv */
-    SDL_iPhoneSetEventPump(SDL_TRUE);
+    SDL_iOSSetEventPump(SDL_TRUE);
     exit_status = forward_main(forward_argc, forward_argv);
-    SDL_iPhoneSetEventPump(SDL_FALSE);
+    SDL_iOSSetEventPump(SDL_FALSE);
 
     if (launchWindow) {
         launchWindow.hidden = YES;
diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m
index 5c025e0b45422..9afc03638ee8b 100644
--- a/src/video/uikit/SDL_uikitevents.m
+++ b/src/video/uikit/SDL_uikitevents.m
@@ -126,7 +126,7 @@ Uint64 UIKit_GetEventTimestamp(NSTimeInterval nsTimestamp)
     return timestamp;
 }
 
-void SDL_iPhoneSetEventPump(SDL_bool enabled)
+void SDL_iOSSetEventPump(SDL_bool enabled)
 {
     UIKit_EventPumpEnabled = enabled;
 
diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index a13a7bae81dec..db48292663b73 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -449,7 +449,7 @@ void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int
 }
 #endif /* !SDL_PLATFORM_TVOS */
 
-int SDL_iPhoneSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
+int SDL_iOSSetAnimationCallback(SDL_Window *window, int interval, void (*callback)(void *), void *callbackParam)
 {
     if (!window || !window->driverdata) {
         return SDL_SetError("Invalid window");