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 4586 - SDL doesn't work on iPad using "Slide Over" and "Split View" functionality
Summary: SDL doesn't work on iPad using "Slide Over" and "Split View" functionality
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: iPhone/iPod touch iOS 11
: P2 normal
Assignee: Alex Szpakowski
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2019-04-09 16:06 UTC by romain.goyet
Modified: 2019-09-20 20:48 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description romain.goyet 2019-04-09 16:06:13 UTC
There are multiple locations around the current code base that assume that iOS apps take more or less the entire screen. This used to be true.

However, starting with iOS 9, it's now possible to run an app on a part of the screen only. In those case, SDL apps are completely broken because they report the window size as still being more-or-less the entire screen, and therefore most of the content is off-window. 

https://developer.apple.com/library/archive/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForSlideOverAndSplitView.html)
Comment 1 Sam Lantinga 2019-04-17 03:18:43 UTC
Hey Alex, how should we handle this?
Comment 2 Alex Szpakowski 2019-04-17 23:33:21 UTC
(In reply to Sam Lantinga from comment #1)
> Hey Alex, how should we handle this?

Taking a quick look at SDL's iOS source code, there's a few bits like this which seem like they'll require a good amount of testing to make sure no regressions are introduced by supporting split view:

@implementation SDL_uikitwindow

- (void)layoutSubviews
{
    /* Workaround to fix window orientation issues in iOS 8+. */
    self.frame = self.screen.bounds;
    [super layoutSubviews];
}

@end
Comment 3 Sam Lantinga 2019-06-12 03:06:46 UTC
Alex, is this something we can fix after we ship 2.0.10?
Comment 4 Alex Szpakowski 2019-06-12 22:26:06 UTC
(In reply to Sam Lantinga from comment #3)
> Alex, is this something we can fix after we ship 2.0.10?

I probably won't be able to dedicate enough time to properly test and fix this in the very near future, myself. In my opinion we can ship 2.0.10 without a fix for this, but it should ideally be solved before iOS 13 ships.
Comment 5 Sam Lantinga 2019-06-12 23:40:00 UTC
Agreed. Will you be able to revisit this in that timeframe?
Comment 6 Alex Szpakowski 2019-06-13 00:46:01 UTC
I think so, yeah.
Comment 7 Sam Lantinga 2019-06-14 00:08:09 UTC
Great, thanks!
Comment 8 Alex Szpakowski 2019-07-01 17:54:34 UTC
I submitted a change here which fixes it for me: https://hg.libsdl.org/SDL/rev/d3a97780aa05

I did a good amount of testing, and it looks like it was only that line which needed to change. I haven't found any regressions so far. Let me know if it works for you!
Comment 9 romain.goyet 2019-07-02 13:51:00 UTC
As a matter of fact I had eventually written a very similar patch. I didn't submit it because I wasn't confident enough in the fix though, but my patch was virtually the same (I just removed the offending line instead of making it conditional to iOS 9, so yours is definitely better).

Anyway, for what it's worth, it worked in my use case too :-)
Comment 10 romain.goyet 2019-07-02 14:28:16 UTC
I spoke too fast, there are still some issues with this.

Here's a way to reproduce a problem:
 - Run Safari
 - Bring up the dock by swiping up from the bottom of the screen
 - Drag the icon of your SDL app to the right side of the screen to run it in side mode
 - So far, so good, everything works well
 - Now type something in Safari's address bar

Result : rendering is botched in the SDL app.

Tested on iPad Air 2 simulator running iOS 12.1.
Comment 11 romain.goyet 2019-07-02 15:01:17 UTC
Actually this might be another bug in "SDL_GetWindowSize".

I'm using "SDL_GetWindowSize" to recompute the layout of elements in my window, and doing the steps before corrupts the output of SDL_GetWindowSize.

Before clicking the Safari address bar, SDL_GetWindowSize returns 320x728, after clicking the Safari address bar (and not touching anything else), it returns 1024x768.
Comment 12 Sam Lantinga 2019-07-02 15:24:32 UTC
Can you please report the other issue as a separate bug?

Thanks!
Comment 13 romain.goyet 2019-07-02 15:33:26 UTC
Sure! See #4705.
Comment 14 romain.goyet 2019-07-03 08:20:39 UTC
Actually I'm sorry but I think this is far from resolved, so I took the liberty of reopening this issue.
 - See #4705 for at least two bugs in SDL_GetWindowSize that breaks SplitView on iOS
 - Also SDL_uikitwindow.m:111 is now wrong ("window->flags &= ~SDL_WINDOW_RESIZABLE;  /* window is NEVER resizable */"
 - Globally, UIKit_ComputeViewFrame is wrong too (and I'm not sure how it can be easily fixed)
Comment 15 romain.goyet 2019-07-03 08:21:13 UTC
Forgot to reopen w/ my previous comment.
Comment 16 Alex Szpakowski 2019-07-03 18:13:02 UTC
(In reply to romain.goyet from comment #14)
>  - Also SDL_uikitwindow.m:111 is now wrong ("window->flags &=
> ~SDL_WINDOW_RESIZABLE;  /* window is NEVER resizable */"
That particular bit of code is only run when the window is on an external display.
Comment 17 Ryan C. Gordon 2019-07-30 17:49:36 UTC
(Sorry if you get several emails like this, we're marking a bunch of bugs.)

We're hoping to ship SDL 2.0.11 on a much shorter timeframe than we have historically done releases, so I'm starting to tag bugs we hope to have closed in this release cycle.

Note that this tag means we just intend to scrutinize this bug for the 2.0.11 release: we may fix it, reject it, or even push it back to a later release for now, but this helps give us both a goal and a wishlist for the next release.

If this bug has been quiet for a few months and you have new information (such as, "this is definitely still broken" or "this got fixed at some point"), please feel free to retest and/or add more notes to the bug.

--ryan.
Comment 18 Alex Szpakowski 2019-08-15 22:39:49 UTC
I think I've fixed the issues as of https://hg.libsdl.org/SDL/rev/806598d72494 , let me know if you have any more.
Comment 19 Ryan C. Gordon 2019-09-20 20:47:37 UTC
We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc).

As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change!

Thanks,
--ryan.
Comment 20 Ryan C. Gordon 2019-09-20 20:48:38 UTC
We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc).

As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change!

Thanks,
--ryan.