iOS: Use modern replacements for deprecated functions, when available.
parent
efe179cdfe
commit
01050d4ed1
|
@ -419,12 +419,12 @@ extern SDL_bool SDL_ShouldAllowTopmost(void);
|
||||||
|
|
||||||
extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches);
|
extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches);
|
||||||
|
|
||||||
extern void SDL_OnApplicationWillTerminate();
|
extern void SDL_OnApplicationWillTerminate(void);
|
||||||
extern void SDL_OnApplicationDidReceiveMemoryWarning();
|
extern void SDL_OnApplicationDidReceiveMemoryWarning(void);
|
||||||
extern void SDL_OnApplicationWillResignActive();
|
extern void SDL_OnApplicationWillResignActive(void);
|
||||||
extern void SDL_OnApplicationDidEnterBackground();
|
extern void SDL_OnApplicationDidEnterBackground(void);
|
||||||
extern void SDL_OnApplicationWillEnterForeground();
|
extern void SDL_OnApplicationWillEnterForeground(void);
|
||||||
extern void SDL_OnApplicationDidBecomeActive();
|
extern void SDL_OnApplicationDidBecomeActive(void);
|
||||||
|
|
||||||
#endif /* SDL_sysvideo_h_ */
|
#endif /* SDL_sysvideo_h_ */
|
||||||
|
|
||||||
|
|
|
@ -3863,17 +3863,17 @@ SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
|
||||||
/*
|
/*
|
||||||
* Functions used by iOS application delegates
|
* Functions used by iOS application delegates
|
||||||
*/
|
*/
|
||||||
void SDL_OnApplicationWillTerminate()
|
void SDL_OnApplicationWillTerminate(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationDidReceiveMemoryWarning()
|
void SDL_OnApplicationDidReceiveMemoryWarning(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
|
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationWillResignActive()
|
void SDL_OnApplicationWillResignActive(void)
|
||||||
{
|
{
|
||||||
if (_this) {
|
if (_this) {
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
|
@ -3885,17 +3885,17 @@ void SDL_OnApplicationWillResignActive()
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationDidEnterBackground()
|
void SDL_OnApplicationDidEnterBackground(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationWillEnterForeground()
|
void SDL_OnApplicationWillEnterForeground(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_OnApplicationDidBecomeActive()
|
void SDL_OnApplicationDidBecomeActive(void)
|
||||||
{
|
{
|
||||||
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
|
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
|
||||||
|
|
||||||
|
|
|
@ -513,23 +513,24 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
|
||||||
SDL_SendDropComplete(NULL);
|
SDL_SendDropComplete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_OS_TV
|
#if TARGET_OS_TV || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0)
|
||||||
/* TODO: Use this on iOS 9+ as well? */
|
|
||||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
||||||
{
|
{
|
||||||
/* TODO: Handle options */
|
/* TODO: Handle options */
|
||||||
[self sendDropFileForURL:url];
|
[self sendDropFileForURL:url];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
#endif /* TARGET_OS_TV */
|
|
||||||
|
|
||||||
#if !TARGET_OS_TV
|
#else
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
|
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
|
||||||
{
|
{
|
||||||
[self sendDropFileForURL:url];
|
[self sendDropFileForURL:url];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
#endif /* !TARGET_OS_TV */
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -273,6 +273,7 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
int displayIndex = (int) (display - _this->displays);
|
int displayIndex = (int) (display - _this->displays);
|
||||||
SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
|
SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
|
||||||
|
CGRect frame = data.uiscreen.bounds;
|
||||||
|
|
||||||
/* the default function iterates displays to make a fake offset,
|
/* the default function iterates displays to make a fake offset,
|
||||||
as if all the displays were side-by-side, which is fine for iOS. */
|
as if all the displays were side-by-side, which is fine for iOS. */
|
||||||
|
@ -280,9 +281,7 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGRect frame = data.uiscreen.bounds;
|
#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
|
||||||
|
|
||||||
#if !TARGET_OS_TV
|
|
||||||
if (!UIKit_IsSystemVersionAtLeast(7.0)) {
|
if (!UIKit_IsSystemVersionAtLeast(7.0)) {
|
||||||
frame = [data.uiscreen applicationFrame];
|
frame = [data.uiscreen applicationFrame];
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,22 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char
|
||||||
- (void)startAnimation
|
- (void)startAnimation
|
||||||
{
|
{
|
||||||
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)];
|
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)];
|
||||||
[displayLink setFrameInterval:animationInterval];
|
|
||||||
|
#ifdef __IPHONE_10_3
|
||||||
|
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
|
if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)]
|
||||||
|
&& data != nil && data.uiwindow != nil
|
||||||
|
&& [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) {
|
||||||
|
displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300
|
||||||
|
[displayLink setFrameInterval:animationInterval];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,10 +170,12 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char
|
||||||
return UIKit_GetSupportedOrientations(window);
|
return UIKit_GetSupportedOrientations(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
|
||||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient
|
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient
|
||||||
{
|
{
|
||||||
return ([self supportedInterfaceOrientations] & (1 << orient)) != 0;
|
return ([self supportedInterfaceOrientations] & (1 << orient)) != 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
- (BOOL)prefersStatusBarHidden
|
- (BOOL)prefersStatusBarHidden
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue