Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dim or hide the Home indicator on iPhone X (and future iOS devices without a Home button) #2807

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Assignees

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.7
Reported for operating system, platform: iOS 11, iPhone/iPod touch

Comments on the original bug report:

On 2018-01-21 11:33:11 +0000, Dominik Reichardt wrote:

The Home indicator is thick line at the bottom of the screen that you swipe up to get to the Home screen. it can be pretty distracting but Apple, for now, doesn't want to give an option to hide it.
In your own code you can have two options to deal with it in the viewcontroller:

You can hide it but it will reactivate on every touch event - so it's only good for programs that don't require interactivity often (e.g. video playback) via

-(BOOL)prefersHomeIndicatorAutoHidden
{
return YES;
}

You can dim it (translucent) and it will only react to a second swipe via

  • (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
    {
    return UIRectEdgeBottom;
    }

It's either/or, you cannot mix them, when you auto hide the indicator you cannot dim it via the second code.

In SDL2 2.0.7 code, I was able to implement this by adding these to SDL_uikitappdelegate.m under the @implementation SDLLaunchScreenController and in SDL_uikitviewcontroller.m under @implementation SDL_uikitviewcontroller. I needed to add ti to both or an UIAlertController (for example an SDL messagebox) would at least unset the UIRectEdge way.

Implementing it like this is probably wrong and more likely needs to go into AppDelegate but I couldn't make that work, so no patch for it.

Also to control the behavior it should have yet another SDL Hint (0= default, 1= autohide, 2= dim).

On 2018-01-21 16:20:07 +0000, Dominik Reichardt wrote:

It should be enough to add this in SDL_uikitviewcontroller.m but it seems there is something odd going on with the SDL_uikitmessagebox.m code. When you show an alert either of these methods to handle the Home indicator do no longer work.

A good testcase is testsprite.c:

  • in the void loop, while (SDL_PollEvent(&event)) { add switch and a case SDL_FINGERDOWN to show a simple SDL Messagebox:
    /* Check for events */
    while (SDL_PollEvent(&event)) {
    switch (event.type) {
    case SDL_FINGERDOWN:
    SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
    "Simple MessageBox", "Just a simple messagebox", NULL);
    break;
    }
    }

  • add -(BOOL)prefersHomeIndicatorAutoHidden in SDL_uikitviewcontroller.m

  • when you run the testsprite2 test via TestiPhoneOS.xcodeproj the Home indicator will be hidden after second. When you touch the screen the SDL Messagebox will show, cancel it and the Home indicator will no longer hide.

On 2018-02-01 23:22:01 +0000, Sam Lantinga wrote:

Good info, thanks!

This is implemented with a hint controlling the behavior, along with a fix for the message box, here:
https://hg.libsdl.org/SDL/rev/fe303e78ea49

On 2018-02-02 10:39:37 +0000, Dominik Reichardt wrote:

Created attachment 3158
proposed partial patch for SDL_uikitappdelegate

For my project I needed the check in both locations and added the changes in the patch to @implementation SDLLaunchScreenController.
Without it the home indicator hint only "took" after the first UIAlertController alert. Very likely something wrong in my project, though :(
I will need to compare how other projects handle this properly.

On 2018-02-02 18:14:43 +0000, Sam Lantinga wrote:

I tested this with testsprite2.c
Do you have something else going on in your app launch sequence?

On 2018-02-02 18:25:29 +0000, Dominik Reichardt wrote:

I think we can close it, I'm pretty sure it is something odd that Exult is doing. Coming from SDL 1.2x and then being ported to SDL2 and iOS might have led to strange things.
And since our development team is no longer very active and I'm not really good... bla bla bla :)
Let's leave it as resolved :)

Thanks a lot!

@slouken slouken self-assigned this Feb 21, 2022
@slouken slouken added this to the 2.0.22 milestone Feb 21, 2022
@slouken slouken reopened this Feb 21, 2022
@slouken slouken modified the milestones: 2.0.22, 2.0.24 Mar 17, 2022
@slouken slouken added the early in milestone This change should be made early in the milestone for additional testing label Mar 17, 2022
@slouken slouken removed the bug label May 11, 2022
@slouken slouken closed this as completed Jun 17, 2022
@slouken slouken removed the early in milestone This change should be made early in the milestone for additional testing label Jun 17, 2022
@slouken slouken removed this from the 2.24.0 milestone Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants