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

Bring back iOS application delegates and fix many issues #6453

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

frenzibyte
Copy link
Member

After going through separate issues that ask for having access to a custom app delegate class, and specifically after #6449 / libsdl-org/SDL#11627, I've looked into bringing app delegate classes back.

Reading the SDL's codebase and various PRs in the repo, I've noticed that SDL intentionally doesn't do anything special/internal for its API in the app delegate class it uses for the application. This is to allow consumers that wish for a custom app delegate class to create one without extra effort (although I had to do this 3134295).

In order to use SDL without their own app delegate class, the SDL_RunApp should be omitted and we should call UIApplication.Main on our app delegate class directly instead, and at finishedLaunching, we just have to call SDL_SetMainReady to mark it as ready for initialisation.

For detailed reasons as to why this PR exists:

  • SDL disables the UIKit event pump after we return from the main function call that used to exist as GameApplication.main. Disabling the UIKit event pump causes the application to not receive will/did enter background/foreground events, therefore never suspending/unfocusing when sent to background.
    • We have also been doing this ourselves, but after quick discord inquiry, it was decided that it can be safely removed, and so it is 3ef7542.
    • While this can be fixed at SDL's side by just asking them to not disable the thing or do something about it, we can just have our own app delegate class and call it a day.
  • We need a UIApplicationDelegate class to control the list of allowed orientations, to add support for Disable screen rotation while in active gameplay osu#5331
  • I am of firm belief that a UIApplicationDelegate class is mandatory to have in any application for full flexibility over the app's configuration/behaviour, as well as handling various app-level events which may otherwise require asking SDL to add while not being of priority to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant