iOS: remove dead pre-iOS 8 codepaths. SDL hasn't supported those older iOS versions for a little while now.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
diff --git a/docs/README-ios.md b/docs/README-ios.md
index cae5f9c..e13f8ba 100644
--- a/docs/README-ios.md
+++ b/docs/README-ios.md
@@ -293,7 +293,7 @@ e.g.
Deploying to older versions of iOS
==============================================================================
-SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 6.1
+SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
In order to do that you need to download an older version of Xcode:
https://developer.apple.com/download/more/?name=Xcode
diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m
index 4c21d73..635ed76 100644
--- a/src/video/uikit/SDL_uikitappdelegate.m
+++ b/src/video/uikit/SDL_uikitappdelegate.m
@@ -141,10 +141,9 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
NSString *screenname = nibNameOrNil;
NSBundle *bundle = nibBundleOrNil;
- BOOL atleastiOS8 = UIKit_IsSystemVersionAtLeast(8.0);
- /* Launch screens were added in iOS 8. Otherwise we use launch images. */
- if (screenname && atleastiOS8) {
+ /* A launch screen may not exist. Fall back to launch images in that case. */
+ if (screenname) {
@try {
self.view = [bundle loadNibNamed:screenname owner:self options:nil][0];
}
@@ -241,9 +240,9 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
UIImageOrientation imageorient = UIImageOrientationUp;
#if !TARGET_OS_TV
- /* Bugs observed / workaround tested in iOS 8.3, 7.1, and 6.1. */
+ /* Bugs observed / workaround tested in iOS 8.3. */
if (UIInterfaceOrientationIsLandscape(curorient)) {
- if (atleastiOS8 && image.size.width < image.size.height) {
+ if (image.size.width < image.size.height) {
/* On iOS 8, portrait launch images displayed in forced-
* landscape mode (e.g. a standard Default.png on an iPhone
* when Info.plist only supports landscape orientations) need
@@ -253,15 +252,6 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
} else if (curorient == UIInterfaceOrientationLandscapeRight) {
imageorient = UIImageOrientationLeft;
}
- } else if (!atleastiOS8 && image.size.width > image.size.height) {
- /* On iOS 7 and below, landscape launch images displayed in
- * landscape mode (e.g. landscape iPad launch images) need
- * to be rotated to display in the expected orientation. */
- if (curorient == UIInterfaceOrientationLandscapeLeft) {
- imageorient = UIImageOrientationLeft;
- } else if (curorient == UIInterfaceOrientationLandscapeRight) {
- imageorient = UIImageOrientationRight;
- }
}
}
#endif
@@ -378,7 +368,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
#if !TARGET_OS_TV
screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
- if (screenname && UIKit_IsSystemVersionAtLeast(8.0)) {
+ if (screenname) {
@try {
/* The launch storyboard is actually a nib in some older versions of
* Xcode. We'll try to load it as a storyboard first, as it's more
diff --git a/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m
index b6d56f3..2c42ba7 100644
--- a/src/video/uikit/SDL_uikitmessagebox.m
+++ b/src/video/uikit/SDL_uikitmessagebox.m
@@ -124,86 +124,16 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in
return YES;
}
-/* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */
-#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
-@interface SDLAlertViewDelegate : NSObject <UIAlertViewDelegate>
-
-@property (nonatomic, assign) int *clickedIndex;
-
-@end
-
-@implementation SDLAlertViewDelegate
-
-- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
-{
- if (_clickedIndex != NULL) {
- *_clickedIndex = (int) buttonIndex;
- }
-}
-
-@end
-#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */
-
-static BOOL
-UIKit_ShowMessageBoxAlertView(const SDL_MessageBoxData *messageboxdata, int *buttonid)
-{
- /* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */
-#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
- int i;
- int clickedindex = messageboxdata->numbuttons;
- UIAlertView *alert = [[UIAlertView alloc] init];
- SDLAlertViewDelegate *delegate = [[SDLAlertViewDelegate alloc] init];
-
- alert.delegate = delegate;
- alert.title = @(messageboxdata->title);
- alert.message = @(messageboxdata->message);
-
- for (i = 0; i < messageboxdata->numbuttons; i++) {
- const SDL_MessageBoxButtonData *sdlButton;
- if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
- sdlButton = &messageboxdata->buttons[messageboxdata->numbuttons - 1 - i];
- } else {
- sdlButton = &messageboxdata->buttons[i];
- }
- [alert addButtonWithTitle:@(sdlButton->text)];
- }
-
- delegate.clickedIndex = &clickedindex;
-
- [alert show];
-
- UIKit_WaitUntilMessageBoxClosed(messageboxdata, &clickedindex);
-
- alert.delegate = nil;
-
- if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
- clickedindex = messageboxdata->numbuttons - 1 - clickedindex;
- }
- *buttonid = messageboxdata->buttons[clickedindex].buttonid;
- return YES;
-#else
- return NO;
-#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */
-}
-
static void
UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue)
+{ @autoreleasepool
{
- BOOL success = NO;
-
- @autoreleasepool {
- success = UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid);
- if (!success) {
- success = UIKit_ShowMessageBoxAlertView(messageboxdata, buttonid);
- }
- }
-
- if (!success) {
- *returnValue = SDL_SetError("Could not show message box.");
- } else {
+ if (UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid)) {
*returnValue = 0;
+ } else {
+ *returnValue = SDL_SetError("Could not show message box.");
}
-}
+}}
int
UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m
index 218b064..8bc3380 100644
--- a/src/video/uikit/SDL_uikitmetalview.m
+++ b/src/video/uikit/SDL_uikitmetalview.m
@@ -87,11 +87,7 @@ UIKit_Metal_CreateView(_THIS, SDL_Window * window)
* dimensions of the screen rather than the dimensions in points
* yielding high resolution on retine displays.
*/
- if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) {
- scale = data.uiwindow.screen.nativeScale;
- } else {
- scale = data.uiwindow.screen.scale;
- }
+ scale = data.uiwindow.screen.nativeScale;
}
metalview = [[SDL_uikitmetalview alloc] initWithFrame:data.uiwindow.bounds
diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m
index bfd7a64..322240d 100644
--- a/src/video/uikit/SDL_uikitmodes.m
+++ b/src/video/uikit/SDL_uikitmodes.m
@@ -150,11 +150,7 @@
* Estimate the DPI based on the screen scale multiplied by the base DPI for the device
* type (e.g. based on iPhone 1 and iPad 1)
*/
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
float scale = (float)screen.nativeScale;
- #else
- float scale = (float)screen.scale;
- #endif
float defaultDPI;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
defaultDPI = 132.0f;
@@ -503,12 +499,6 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
return -1;
}
-#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
- if (!UIKit_IsSystemVersionAtLeast(7.0)) {
- frame = [data.uiscreen applicationFrame];
- }
-#endif
-
rect->x += frame.origin.x;
rect->y += frame.origin.y;
rect->w = frame.size.width;
diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m
index 86fefd7..15ea2e3 100644
--- a/src/video/uikit/SDL_uikitopengles.m
+++ b/src/video/uikit/SDL_uikitopengles.m
@@ -150,9 +150,8 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window)
* versions. */
EAGLRenderingAPI api = major;
- /* iOS currently doesn't support GLES >3.0. iOS 6 also only supports up
- * to GLES 2.0. */
- if (major > 3 || (major == 3 && (minor > 0 || !UIKit_IsSystemVersionAtLeast(7.0)))) {
+ /* iOS currently doesn't support GLES >3.0. */
+ if (major > 3 || (major == 3 && minor > 0)) {
SDL_SetError("OpenGL ES %d.%d context could not be created", major, minor);
return NULL;
}
@@ -170,11 +169,7 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window)
/* Set the scale to the natural scale factor of the screen - the
* backing dimensions of the OpenGL view will match the pixel
* dimensions of the screen rather than the dimensions in points. */
- if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) {
- scale = data.uiwindow.screen.nativeScale;
- } else {
- scale = data.uiwindow.screen.scale;
- }
+ scale = data.uiwindow.screen.nativeScale;
}
context = [[SDLEAGLContext alloc] initWithAPI:api sharegroup:sharegroup];
diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m
index ef5ca74..ea4db41 100644
--- a/src/video/uikit/SDL_uikitopenglview.m
+++ b/src/video/uikit/SDL_uikitopenglview.m
@@ -93,14 +93,8 @@
}
if (sRGB) {
- /* sRGB EAGL drawable support was added in iOS 7. */
- if (UIKit_IsSystemVersionAtLeast(7.0)) {
- colorFormat = kEAGLColorFormatSRGBA8;
- colorBufferFormat = GL_SRGB8_ALPHA8;
- } else {
- SDL_SetError("sRGB drawables are not supported.");
- return nil;
- }
+ colorFormat = kEAGLColorFormatSRGBA8;
+ colorBufferFormat = GL_SRGB8_ALPHA8;
} else if (rBits >= 8 || gBits >= 8 || bBits >= 8 || aBits > 0) {
/* if user specifically requests rbg888 or some color format higher than 16bpp */
colorFormat = kEAGLColorFormatRGBA8;
diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m
index 8afb665..2b014bc 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -209,15 +209,6 @@ UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen)
frame = data.uiwindow.bounds;
}
-#if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)
- BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0);
-
- /* The view should always show behind the status bar in iOS 7+. */
- if (!hasiOS7 && !(window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) {
- frame = screen.applicationFrame;
- }
-#endif
-
#if !TARGET_OS_TV
/* iOS 10 seems to have a bug where, in certain conditions, putting the
* device to sleep with the a landscape-only app open, re-orienting the
@@ -227,18 +218,16 @@ UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen)
* https://bugzilla.libsdl.org/show_bug.cgi?id=3505
* https://bugzilla.libsdl.org/show_bug.cgi?id=3465
* https://forums.developer.apple.com/thread/65337 */
- if (UIKit_IsSystemVersionAtLeast(8.0)) {
- UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;
- BOOL landscape = UIInterfaceOrientationIsLandscape(orient);
- BOOL fullscreen = CGRectEqualToRect(screen.bounds, frame);
-
- /* The orientation flip doesn't make sense when the window is smaller
- * than the screen (iPad Split View, for example). */
- if (fullscreen && (landscape != (frame.size.width > frame.size.height))) {
- float height = frame.size.width;
- frame.size.width = frame.size.height;
- frame.size.height = height;
- }
+ UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;
+ BOOL landscape = UIInterfaceOrientationIsLandscape(orient);
+ BOOL fullscreen = CGRectEqualToRect(screen.bounds, frame);
+
+ /* The orientation flip doesn't make sense when the window is smaller
+ * than the screen (iPad Split View, for example). */
+ if (fullscreen && (landscape != (frame.size.width > frame.size.height))) {
+ float height = frame.size.width;
+ frame.size.width = frame.size.height;
+ frame.size.height = height;
}
#endif
diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m
index 4aa2d28..ee7ee83 100644
--- a/src/video/uikit/SDL_uikitviewcontroller.m
+++ b/src/video/uikit/SDL_uikitviewcontroller.m
@@ -204,13 +204,6 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o
return UIKit_GetSupportedOrientations(window);
}
-#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient
-{
- return ([self supportedInterfaceOrientations] & (1 << orient)) != 0;
-}
-#endif
-
- (BOOL)prefersStatusBarHidden
{
BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0;
@@ -334,8 +327,6 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o
}
}
-/* willRotateToInterfaceOrientation and didRotateFromInterfaceOrientation are deprecated in iOS 8+ in favor of viewWillTransitionToSize */
-#if TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
@@ -345,17 +336,6 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o
self->rotatingOrientation = NO;
}];
}
-#else
-- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
- [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
- rotatingOrientation = YES;
-}
-
-- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
- [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
- rotatingOrientation = NO;
-}
-#endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */
- (void)deinitKeyboard
{
diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index b095c5d..8a923fb 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -286,10 +286,7 @@ UIKit_UpdateWindowBorder(_THIS, SDL_Window * window)
[UIApplication sharedApplication].statusBarHidden = NO;
}
- /* iOS 7+ won't update the status bar until we tell it to. */
- if ([viewcontroller respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
- [viewcontroller setNeedsStatusBarAppearanceUpdate];
- }
+ [viewcontroller setNeedsStatusBarAppearanceUpdate];
}
/* Update the view's frame to account for the status bar change. */
@@ -427,7 +424,7 @@ UIKit_GetSupportedOrientations(SDL_Window * window)
* us, we get the orientations from Info.plist via UIApplication. */
if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) {
validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow];
- } else if ([app respondsToSelector:@selector(supportedInterfaceOrientationsForWindow:)]) {
+ } else {
validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow];
}