Repository navigation
Conversation
Native full screen keeps a notched MacBook's picture below the menu bar (3024x1898 on a 14" MacBook Pro), and the strips beside the camera housing stay black. With DM_FULLSCREEN=2, full screen on a screen with a top safe-area inset is instead a borderless window over the screen's whole frame (3024x1964): the custom full screen Apple documents with NSScreen.safeAreaInsets and auxiliaryTopLeftArea, built as SDL3 and GLFW build theirs. DmGameWindow is key and main while borderless, and its constrainFrameRect:toScreen: leaves the frame alone while the panel is up; level NSMainMenuWindowLevel+1, HideDock|HideMenuBar (0xa, so no menu bar on hover). A screen without a notch gets native full screen, exactly as DM_FULLSCREEN=1. The present fits the game's 16:9 picture into the panel as into any drawable, with bars at the sides; a game that takes the screen's shape fills it. DmGameWindow's toggleFullScreen: picks the panel or native full screen, so ⌃⌘F, the green button, the startup request and the GPU-lost path all follow the setting. win_full() replaces the full-screen style checks (screen_match_apply, so the 120 Hz screen match still applies; startup). Screen changes refit the panel, or leave it when its screen has no notch (a Studio Display in clamshell). While another app is active the window drops to its own level and the presentation options are cleared; activation puts both back. While a modal box is up (the software keyboard, the user choice, a Cheats question) the panel takes the window's own level, so the box shows above it; the Cheats panel is raised above the game window. One [notch] line on entering and on leaving. pack_app.py writes NSPrefersDisplaySafeAreaCompatibilityMode false, so macOS never letterboxes the screen below the camera housing instead. Launcher: Display mode gets "Fullscreen around the notch". Docs: env_switches.tsv, settings.md, development.md. Checked: the OoT host builds with no new warnings; test_launcher_settings and test_nsp_mac_app cover the new option and the Info.plist key. Played on an M5 MacBook Pro, macOS 27: a prototype of this window, and Ocarina of Time on a branch with PR seedds#2978's Auto aspect, filled 3024x1964 at about 120 fps, with no menu bar on hover. This branch alone (16:9 with side bars) was not run. Not checked: other Macs, the M1 and M2, Game Mode (off in nxnative apps anyway). Front-ends: new: DM_FULLSCREEN=2 needs NSPrefersDisplaySafeAreaCompatibilityMode false in the app's Info.plist (pack_app.py writes it); an app packed another way needs the key too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2 tasks done
|
I tried this on my M1 Max MacBook with Ocarina of Time. It starts with a full white screen (including next to notch), but once in the game it's letterboxed in menu, cutscenes and gameplay. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
On a MacBook with a notch, native full screen keeps the picture below the menu bar (3024x1898 on a 14" MacBook Pro). The strips beside the camera housing stay black, and the menu bar drops into them when the pointer reaches the top. Native full screen can't be moved under the notch through any public API: the system places full-screen content in the safe area.
This adds a third Display mode, Fullscreen around the notch (
DM_FULLSCREEN=2). On a screen with a top safe-area inset, full screen becomes a borderless window over the screen's whole frame (3024x1964). On a screen without a notch it is the same asDM_FULLSCREEN=1. Window and Fullscreen are unchanged, and Window is still the default.How it works (
front_mac.m):DmGameWindowcan be key and main while borderless. ItsconstrainFrameRect:toScreen:leaves the frame alone while the panel is up, so AppKit doesn't push it below the menu bar.NSMainMenuWindowLevel + 1, presentation optionsHideDock | HideMenuBar: no Dock, and no menu bar on hover.toggleFullScreen:picks the panel or native full screen, so ⌃⌘F, the green button, the startup request and the GPU-lost path all follow the setting.win_full()replaces the full-screen style checks, so the 120 Hz → 60 Hz screen match also applies in the panel.pack_app.pywritesNSPrefersDisplaySafeAreaCompatibilityMode = false, so macOS never letterboxes the whole screen below the camera housing instead.Picture shape. The present fits the game's picture into the drawable, as it does for any window. Alone, this PR shows a 16:9 game fitted in the 3024x1964 panel with bars at the sides, and the strip beside the notch is part of the drawable. With #2978 (Auto aspect for Ocarina of Time), the camera takes the panel's 1.54 and the picture fills it. The two PRs are independent, both off
main, and touch neighbouring lines infront_mac.m. If both land,panel_enterandpanel_leaveneed the two Auto-aspect calls that the native DidEnter / WillExit observers make (g_aspect_full = 1/0; aspect_auto();). I can rebase whichever goes in second.Technique and sources
This is the "custom full-screen experience" Apple documents for notched screens, and the same window SDL3 and GLFW build for their exclusive full screen:
NSScreen.safeAreaInsets: "If your app offers a custom full-screen experience, apply the specified insets…"; nativetoggleFullScreen:"automatically positions the window's contents within the safe area".NSScreen.auxiliaryTopLeftArea: "If your app offers a custom full-screen experience, use this property to determine what additional space is available".NSPrefersDisplaySafeAreaCompatibilityMode. Firefox set it toNOfor the same reason (bug 1737953).SDL_cocoawindow.m(borderless,CGDisplayBounds,kCGMainMenuWindowLevel + 1) and GLFWcocoa_window.m(NSMainMenuWindowLevel + 1). SDL issue 10441 shows that the Spaces full screen is "bumped down below the notch".constrainFrameRectand presentation-options details.Trade-offs (the first two are in
docs/settings.md): the panel has no Space of its own and stays on the current desktop; the camera housing hides the picture's top centre; Apple's HIG prefers the system full screen.Checked
GAME=0400486024DEC000, Xcode 27.2):make -C dm/host dmhost: links. The onlyfront_mac.mwarning (activityset but not used) is also onmain.test_launcher_settings(the new option),test_nsp_mac_app(the Info.plist key),test_settings,test_docs: OK. The wholedm/tools/tests: 1759 tests. The only failures are intest_shader_toolchain_cache(NameError: dmsh_rewrite), and they fail the same way onmain.env_switches.py --check: OK.lint_c.py tidy(only LLVM 22 here, CI pins 23),lint_python.py(ruff and pyright not installed), GPU tests (the present is untouched).0400486024DEC000v131072 on a local branch with this change and game: Ocarina of Time's camera takes the full screen's aspect #2978 on top. Both filled 3024x1964 at about 120 fps, with no menu bar on hover.DmGameWindow'stoggleFullScreen:), ⌃⌘F out of the panel and back while playing, the modal-box level bracket, other MacBooks with a notch, M1 and M2, iOS (not affected), Game Mode and direct-to-display for a borderless window (nxnative apps ship with Game Mode off), and clamshell or docking with the panel up.regress.py: not run. The change is the Mac window only, behindDM_FULLSCREEN=2: with 0 or 1,toggleFullScreen:callssuperandwin_full()is the old style check.Front ends
Front-ends: new: DM_FULLSCREEN=2 needs NSPrefersDisplaySafeAreaCompatibilityMode false in the app's Info.plist (pack_app.py writes it); an app packed another way needs the key too.
Docs
docs/settings.md(Display mode, the env table),docs/env_switches.tsv(DM_FULLSCREEN),docs/development.md(the Info.plist line).🤖 Generated with Claude Code