openframeworks / openframeworks/openFrameworks
[feature request] [macOS] native fullscreen behaviour
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
in order to pull maximum efficiency of macOS14+ game mode, "transparently" call [cocoaWindow toggleFullScreen:nil] on the window. (the proposed custom fullscreen would be exempted from this feature in order to escape from the macOS fullscreen limits).
in addition to enabling game mode, this has the advantage of maintaining 1:1 with the native fullscreen triggers, which are:
- green windowbar button
- "enter full screen" menu item
- fn-F / ctrl-cmd-F global keystroke
tell application "System Events" to tell process "myFullScreenApp" to set value of attribute "AXFullScreen" of window 1 to true).
this means some care is needed to make sure the GLFW callbacks and cocao native full screen state are properly interpreted so OF "knows" it has been made fullscreen.
because GLFW is buggy only since macOS13 and game mode only available since macOS14+, and because perhaps some user apps have been tailored to specific expectations that are hard to know about, maybe not change the behaviour on previous macOS versions:
if (@available(macOS 13.0, *)) {
// call native full screen
// - macOS13: to workaround GLFW sync bug
// - macOS14+: as above + game mode
} else {
// call OF full screen
}
additional help function:
// \brief checks if OF is running in a native fullscreen window
// returns true if the native fullscreen bit is set
bool ofGetNativeFullScreenState() const
because the implementation is in a critical area of OF it might be pertinent to perform and test in parallel the different "fullscreen" issues? such as https://github.com/openframeworks/openFrameworks/issues/5158
note for users:
the Mission Control / Spaces Settings determines the behaviour of windows within a multi-monitor setup.
- if you want a window to go across more than 1 monitor (i.e. span), you need to disable "Display have distinct spaces"
- if you want to fullscreen a single monitor, but not fade to black your other monitors, you need to enable "Displays have distinct spaces"
In other words:
- "Displays have distinct spaces" means you can have a single-monitor fullscreen app in one monitor, plus other windows in other monitors (individually fullscreened or not)
- "Displays don't have distinct spaces" allows you to span windows accross monitors, but toggling native fullscreen will adapt the OF window to a single monitor and fade the rest to black.
so if you want to span across monitors you are outside native macOS native fullscreen territory and you need to use "no distinct spaces" and ofSetWindowPosiiton/Shape with ofGLFWWindowSettings.decorated = false or a "custom rect" flavor of ofFullScreen(and until the vsync bug in GLFW is fixed or otherwise properly addressed, presumably fallback to something like ofGetExpectedPaintTimef if you need to draw time-dependent things accurately).
in all cases, as of macOS14, a single-monitor native fullscreen window plus the "game" app type in info.plist is required for game mode to kick in.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing macOS GLFW fullscreen handling, the cocoaWindow integration, and the related issues 7759, 5158, 7760, and 7758. Verify native fullscreen triggers and GLFW callbacks across macOS 13+, confirm the native fullscreen state can be queried, and preserve the existing behavior on older macOS versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, macos
- Domain
- desktop, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100