Skip to content

front_mac: DM_SCREEN opens the game window on a given screen - #670

Open
v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:dm-screen
Open

v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:dm-screen

Conversation

@v0lumehi

Copy link
Copy Markdown
Contributor

What and why

With two displays, a Mac game window opened on the other display than the launcher's in 2 of 3 runs (seen while testing the fullscreen work in #665). The window is created by a process that is not active yet, so macOS picks the screen itself. A launcher that wants the game on its own display (for example the display console mode runs on) had no way to say so.

Change: a new switch DM_SCREEN=<number>, the NSScreenNumber (CGDirectDisplayID) from NSScreen.deviceDescription. When a connected screen has that number, front_run centres the window in that screen's visible frame, after the window is created and before it is shown, so before any DM_FULLSCREEN request. The window size is unchanged. When it is unset, or no connected screen has that number, nothing changes. One log line names the screen used or says why the number was ignored. Documented in docs/env_switches.tsv and docs/development.md.

Neighbouring code: #665 changes the DM_FULLSCREEN request a few lines further down in the same function. The two are independent (this one touches only the window's position, #665 only when the fullscreen request is made) and combine in the order position first, request second: the window is on the chosen screen when #665 waits for the app to be active and the Space to be active, so fullscreen is entered on that screen.

Checked

  • Tests: make -C dm/host GAME=010015100B514000 builds, make -C dm/host/tests GAME=010015100B514000 run passes, dm/tools/lint_python.py 0 new, dm/tools/env_switches.py --check passes, dm/tools/tests/test_docs.py passes.
  • Games run: none. A small harness compiled from the exact switch block (a titled 1280x720 window, centred, then the block) on a Mac with a built-in and an external display: DM_SCREEN set to each display's number put the window on it (win.screen matched), an unknown number logged ignored and left the default screen, unset left the default. The host itself was built, not run with a window, and not combined with front_mac: enter fullscreen once the app is active and on the active Space #665 in a Space transition.
  • Devices and OS: Apple silicon Mac, macOS 27, a built-in display and an external one.
  • regress.py impact HEAD~1..HEAD names Breath of the Wild, Pokemon Scarlet and Tears of the Kingdom as affected and Hades as broad, only because every call from front_run is followed into the NVN loader. The change is in the window setup, which a headless regress.py check run never reaches (no DM_WINDOW), so no check was run.

Docs

  • The finding is in its game note or its docs/reference/<subsystem>.md entry: not applicable, a new switch and not a finding. It is in docs/env_switches.tsv and docs/development.md
  • No game files, keys or data extracted from a game in the change or the attachments

@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m) docs Documentation labels Nov 3, 2026
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
Upstream-Status: forwarded seedds#670
Reason: a game opens on the launcher's display only with this switch until upstream merges it
Issue: LNPANDY/NX2Apple#221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant