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.
main
Ryan C. Gordon 2024-04-13 14:30:30 -04:00
parent d252a8fe12
commit 6e1ed94913
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
12 changed files with 40 additions and 31 deletions

View File

@ -3134,3 +3134,13 @@ typedef SDL_Colour, SDL_Color;
- SDL_WinRTGetFSPathUTF8
+ SDL_WinRTGetFSPath
(...)
@@
@@
- SDL_iPhoneSetAnimationCallback
+ SDL_iOSSetAnimationCallback
(...)
@@
@@
- SDL_iPhoneSetEventPump
+ SDL_iOSSetEventPump
(...)

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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();

View File

@ -404,9 +404,9 @@ static UIImage *SDL_LoadLaunchImageNamed(NSString *name, int screenh)
[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;

View File

@ -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;

View File

@ -449,7 +449,7 @@ UIKit_GetSupportedOrientations(SDL_Window *window)
}
#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");