Skip to content

Conversation

jslegendre
Copy link
Contributor

Do not add UISupportsTrueScreenSizeOnMac to apps.

Per Apple documentation, this key tells macOS the app is (among other things) capable of handling any display size and "all conceivable aspect ratios", which is obviously something we can't presume. I can image this would (if the window was visible) cause other bugs to pop up around UI and input mapping.

Finally, the actual reason windows aren't visible is actually pretty simple. The root application delegate class for iOS on Mac apps (UINSApplicationDelegate) receives a didCreateUIScene callback (or notification, didn't look much further into it) on didCreateUIScene:transitionContextDictionary: which falls through to _configureWindowControllerCreatingIfNeededForScene:transitionContextDictionary:, where the main window controller is created. The root class for iOS on Mac (and Catalyst) window controllers is UINSSceneWindowController which has a method called _showWindowPostLoadIsFirstWindow:transitionContextDictionary: (invoked during _configureWindowController...) which checks for the UISupportsTrueScreenSizeOnMac key and SKIPS calling [NSWindow makeKeyAndOrderFront:] if found.

tl;dr: Window controller never calls [NSWindow makeKeyAndOrderFront:] if UISupportsTrueScreenSizeOnMac is true.

Do not add `UISupportsTrueScreenSizeOnMac` to apps.

Per Apple documentation, this key tells macOS the app is (among other things) capable of handling any display size and "all conceivable aspect ratios", which is obviously something we can't presume. I can image this would (if the window was visible) cause other bugs to pop up around UI and input mapping.

Finally, the actual reason windows aren't visible is actually pretty simple.
The root application delegate class for iOS on Mac apps (`UINSApplicationDelegate`) receives a `didCreateUIScene` callback (or notification, didn't look much further into it) on `didCreateUIScene:transitionContextDictionary:` which falls through to `_configureWindowControllerCreatingIfNeededForScene:transitionContextDictionary:` where the main window controller is created. The root class for iOS on Mac (and Catalyst) window controllers is `UINSSceneWindowController` which has a method called `_showWindowPostLoadIsFirstWindow:transitionContextDictionary:` (invoked during  `_configureWindowController...`) which checks for the `UISupportsTrueScreenSizeOnMac` key and SKIPS calling `[NSWindow makeKeyAndOrderFront:]` if found.

tl;dr: Window controller never calls `[NSWindow makeKeyAndOrderFront:]` if `UISupportsTrueScreenSizeOnMac` is true.
@JoseMoreville JoseMoreville merged commit 4f20848 into PlayCover:develop Oct 31, 2022
@Depal1 Depal1 linked an issue Oct 31, 2022 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: Some apps open without a window
3 participants