summaryrefslogtreecommitdiff
path: root/src/video/uikit/SDL_uikitviewcontroller.m
diff options
context:
space:
mode:
authorAlex Szpakowski <slime73@gmail.com>2014-07-16 21:06:15 -0300
committerAlex Szpakowski <slime73@gmail.com>2014-07-16 21:06:15 -0300
commit12f7e04e826047e160345afd041edec37f6e710a (patch)
treec65cdc1c760c70727aec19411bad6d469673254e /src/video/uikit/SDL_uikitviewcontroller.m
parentf3ef019576eb0568cf1fc4ef8189744ea8554202 (diff)
downloadsdl-12f7e04e826047e160345afd041edec37f6e710a.tar.gz
Fixed SDL_HINT_ORIENTATIONS to properly allow disabling custom orientations if the hint is set with no valid orientations.
Diffstat (limited to 'src/video/uikit/SDL_uikitviewcontroller.m')
-rw-r--r--src/video/uikit/SDL_uikitviewcontroller.m26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m
index 433b91b2e..52737a348 100644
--- a/src/video/uikit/SDL_uikitviewcontroller.m
+++ b/src/video/uikit/SDL_uikitviewcontroller.m
@@ -69,13 +69,12 @@
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger orientationMask = 0;
+ const char *orientationsHint = SDL_GetHint(SDL_HINT_ORIENTATIONS);
- const char *orientationsCString;
- if ((orientationsCString = SDL_GetHint(SDL_HINT_ORIENTATIONS)) != NULL) {
- BOOL rotate = NO;
- NSString *orientationsNSString = [NSString stringWithCString:orientationsCString
- encoding:NSUTF8StringEncoding];
- NSArray *orientations = [orientationsNSString componentsSeparatedByCharactersInSet:
+ if (orientationsHint != NULL) {
+ NSString *orientationsString = [NSString stringWithCString:orientationsHint
+ encoding:NSUTF8StringEncoding];
+ NSArray *orientations = [orientationsString componentsSeparatedByCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@" "]];
if ([orientations containsObject:@"LandscapeLeft"]) {
@@ -90,14 +89,17 @@
if ([orientations containsObject:@"PortraitUpsideDown"]) {
orientationMask |= UIInterfaceOrientationMaskPortraitUpsideDown;
}
+ }
- } else if (self->window->flags & SDL_WINDOW_RESIZABLE) {
+ if (orientationMask == 0 && window->flags & SDL_WINDOW_RESIZABLE) {
orientationMask = UIInterfaceOrientationMaskAll; /* any orientation is okay. */
- } else {
- if (self->window->w >= self->window->h) {
+ }
+
+ if (orientationMask == 0) {
+ if (window->w >= window->h) {
orientationMask |= UIInterfaceOrientationMaskLandscape;
}
- if (self->window->h >= self->window->w) {
+ if (window->h >= window->w) {
orientationMask |= (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
}
@@ -117,7 +119,7 @@
- (BOOL)prefersStatusBarHidden
{
- if (self->window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) {
+ if (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) {
return YES;
} else {
return NO;
@@ -129,7 +131,7 @@
#ifdef __IPHONE_7_0
return UIStatusBarStyleLightContent;
#else
- /* This is only called in iOS 7+, so the return value isn't important. */
+ /* This method is only used in iOS 7+, so the return value here isn't important. */
return UIStatusBarStyleBlackTranslucent;
#endif
}