We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2798 - [Patch] iOS: major improvements and bug fixes
Summary: [Patch] iOS: major improvements and bug fixes
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: iPhone/iPod touch iOS (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4, triage-2.0.4
Depends on:
Blocks:
 
Reported: 2014-12-03 02:46 UTC by Alex Szpakowski
Modified: 2015-04-13 00:29 UTC (History)
1 user (show)

See Also:


Attachments
Major improvements and bug fixes for iOS (114.56 KB, patch)
2014-12-03 02:46 UTC, Alex Szpakowski
Details | Diff
Major improvements and bug fixes for iOS (144.97 KB, patch)
2015-01-16 04:14 UTC, Alex Szpakowski
Details | Diff
Major improvements and bug fixes for iOS (version 3) (145.17 KB, patch)
2015-01-26 05:33 UTC, Alex Szpakowski
Details | Diff
Major improvements and bug fixes for iOS (version 4) (146.38 KB, patch)
2015-04-08 19:37 UTC, Alex Szpakowski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Szpakowski 2014-12-03 02:46:39 UTC
Created attachment 1951 [details]
Major improvements and bug fixes for iOS

The following changes have been made:

- The SDL_WINDOW_ALLOW_HIGHDPI flag is now needed (along with SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize) to use Retina / high-DPI resolutions, bringing SDL’s Retina-related behaviour on iOS in line with Mac OS X.
- Added iOS-specific SDL_iPhoneGetViewRenderbuffer and SDL_iPhoneGetViewFramebuffer functions.
- Added OpenGL ES debug labels for the Renderbuffer and Framebuffer Objects created with SDL_GL_CreateContext.
- Added support for sRGB OpenGL ES contexts on iOS 7+.
- Added support for SDL_HINT_ACCELEROMETER_AS_JOYSTICK.
- Updated SDL windows to support native-resolution rendering (when SDL_WINDOW_ALLOW_HIGHDPI is enabled) on the iPhone 6 Plus, i.e. 1080x1920 rather than 1242x2208.
- Updated the iOS-specific Objective-C code to use cleaner and more modern language features and APIs, including ARC instead of manual reference counting.
- Updated SDL_HINT_ORIENTATIONS to allow disabling custom orientations if the hint is set with no valid orientation names.
- Fixed several rotation and orientation bugs, especially on iOS 8+.
- Fixed SDL_SetWindowFullscreen failing to update the status bar visibility on iOS 7+.
- Fixed the orientation of the offset applied to the window’s view when the onscreen keyboard is shown in iOS 8+.
- Fixed SDL_IsScreenKeyboardShown (patch by Phil Hassey.)
- Fixed memory leaks caused by missing autorelease pool blocks in the iOS-specific Objective-C code.
- Removed the custom iOS splash screen code, since it was causing several orientation-related issues and didn’t properly support newer iOS devices and versions.
- Removed several dead code paths.
- The iOS 7 SDK (Xcode 5) or newer is now required to build SDL for iOS. Apple also requires Xcode 5.1 or newer to be used when building apps for the App Store.
Comment 1 Alex Szpakowski 2015-01-16 04:14:26 UTC
Created attachment 1991 [details]
Major improvements and bug fixes for iOS

I have attached an updated patch which has several new changes and improvements - mostly reworking some internals of the window and view behavior in the UIKit backend, and also re-adding support for the custom extended launch screen, this time with code that has the proper fallbacks for pre-iOS 8 and doesn't mess up the window orientation.

The changelog in my original comment above is now obsolete, but the new patch contains a new complete changelog / commit message near the top (the patch is in the HG changeset patch format, so it lists my commit message.)
Comment 2 Alex Szpakowski 2015-01-26 05:33:17 UTC
Created attachment 2005 [details]
Major improvements and bug fixes for iOS (version 3)

I updated the patch again, to fix a minor visual glitch that would happen in rare circumstances with the old patch when the screen was rotated after the extended launch screen finished displaying.
Comment 3 Ryan C. Gordon 2015-02-19 05:22:23 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 5 Ryan C. Gordon 2015-04-07 04:57:58 UTC
(sorry if you get a lot of copies of this email, I'm marking several bugs at once)

Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship.

(Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.)

--ryan.
Comment 6 Alex Szpakowski 2015-04-08 19:37:01 UTC
Created attachment 2114 [details]
Major improvements and bug fixes for iOS (version 4)

The patch has been updated to apply without merge conflicts to the latest SDL source code. The patch's changes are listed at the top of the diff file in its commit message, as usual.

I also have a public repository with the changes here: https://bitbucket.org/slime73/sdl-experiments/branch/iOS-improvements (in the iOS-improvements branch of that repository.)
Comment 7 Ryan C. Gordon 2015-04-09 21:46:32 UTC
(In reply to Alex Szpakowski from comment #6)
> Created attachment 2114 [details]
> Major improvements and bug fixes for iOS (version 4)
> 
> The patch has been updated to apply without merge conflicts to the latest
> SDL source code. The patch's changes are listed at the top of the diff file
> in its commit message, as usual.
> 
> I also have a public repository with the changes here:
> https://bitbucket.org/slime73/sdl-experiments/branch/iOS-improvements (in
> the iOS-improvements branch of that repository.)

I would rather have this split up into multiple commits, to avoid having a single changeset with a commit message of "here's a million things that suck less"; is there any reason to not just pull from your repo instead of working from the patch posted here?

One initial note, though:

SDL_iOSGetViewFramebuffer and SDL_iOSGetViewRenderbuffer: can we just put these into the SysWM structure? Sometimes iOS-specific APIs were unavoidable, but I'd rather not add new ones if we don't have to, and syswm is basically designed for this.

(Eventually, we might offer a generic "give me the window system's FBO" since it's zero on some platforms and an FBO that SDL generated on others, but that's for later.)

--ryan.
Comment 8 Alex Szpakowski 2015-04-09 21:55:36 UTC
(In reply to Ryan C. Gordon from comment #7)
> I would rather have this split up into multiple commits, to avoid having a
> single changeset with a commit message of "here's a million things that suck
> less"; is there any reason to not just pull from your repo instead of
> working from the patch posted here?

I was just worried that "here's a million commits at once" might not be desirable, but if you're fine with that then the repo should be fine. :)

> 
> One initial note, though:
> 
> SDL_iOSGetViewFramebuffer and SDL_iOSGetViewRenderbuffer: can we just put
> these into the SysWM structure? Sometimes iOS-specific APIs were
> unavoidable, but I'd rather not add new ones if we don't have to, and syswm
> is basically designed for this.

Ah, I didn't think of that – there should be no problem with that, I'll do it now.

If you do prefer the repository instead of the giant patch then I'll just push to there without attaching a new patch here every time.
Comment 9 Alex Szpakowski 2015-04-09 22:11:34 UTC
(In reply to Alex Szpakowski from comment #8)
> > SDL_iOSGetViewFramebuffer and SDL_iOSGetViewRenderbuffer: can we just put
> > these into the SysWM structure? Sometimes iOS-specific APIs were
> > unavoidable, but I'd rather not add new ones if we don't have to, and syswm
> > is basically designed for this.
> 
> Ah, I didn't think of that – there should be no problem with that, I'll do
> it now.

One potential issue is that if code uses 2.0.3's SDL_syswm.h header but 2.0.4's UIKit_GetWindowWMInfo, then things might crash (SDL would try to modify memory outside of what the code using SDL considers the size of the SDL_SysWMinfo struct to be.)

Since SDL for iOS is only set up to be a static library though (for now), that isn't such a big deal, right?
Comment 10 Alex Szpakowski 2015-04-09 22:30:16 UTC
Nevermind, I implemented a check using the version members of the SDL_SysWMinfo struct. Sorry for the noise!

The repository has been updated with the change: https://bitbucket.org/slime73/sdl-experiments/branch/iOS-improvements
Comment 11 Ryan C. Gordon 2015-04-10 02:42:21 UTC
(In reply to Alex Szpakowski from comment #10)
> Nevermind, I implemented a check using the version members of the
> SDL_SysWMinfo struct. Sorry for the noise!
> 
> The repository has been updated with the change:
> https://bitbucket.org/slime73/sdl-experiments/branch/iOS-improvements

Ok, this is in our repo now, and the named branch is marked as closed.

Nothing quite like landing thousands of lines of changes before finalizing a release!  :)

Resolving this bug (and several others).

--ryan.
Comment 12 Ryan C. Gordon 2015-04-12 01:36:02 UTC
Hey, Alex, Bug #2660 is fixed by this too, right?

--ryan.
Comment 13 Alex Szpakowski 2015-04-12 05:08:25 UTC
It should be I think, yeah: https://hg.libsdl.org/SDL/rev/bff6f1fecc5d


I also just pushed a couple orientation fixes to my SDL fork ( https://bitbucket.org/slime73/sdl-experiments/commits/all ), if you don't mind pushing them to the main SDL repository.
Comment 14 Ryan C. Gordon 2015-04-13 00:29:48 UTC
(In reply to Alex Szpakowski from comment #13)
> It should be I think, yeah: https://hg.libsdl.org/SDL/rev/bff6f1fecc5d

Thanks!

> I also just pushed a couple orientation fixes to my SDL fork (
> https://bitbucket.org/slime73/sdl-experiments/commits/all ), if you don't
> mind pushing them to the main SDL repository.

Merged and pushed.

--ryan.