RFR: 8353314: macOS: Inconsistent fullscreen behavior

Andy Goryachev angorya at openjdk.org
Wed Apr 30 20:44:54 UTC 2025


On Wed, 30 Apr 2025 17:52:01 GMT, Martin Fox <mfox at openjdk.org> wrote:

> macOS will allow any window to enter fullscreen mode but won't expand the window's size if the resizable bit isn't set in the window's style mask. For undecorated stages the code has to set this bit before entering fullscreen and restore the old value after exiting fullscreen.
> 
> The old code was taking a pointer to an NSWindow and casting it to a pointer to an unrelated type (GlassWindow). It was also making an unnecessary check. windowWillEnterFullScreen stashes away the state of the resizable bit before setting it and windowDidExitFullScreen restores the old state. There's no need for setResizableForFullscreen to check anything, it just needs to do what it's told.
> 
> System tests for this case are underway as part of PR #1789.
> 
> You might have difficulty reproducing the bug in the master branch.  The old code was doing a bogus pointer cast and then dereferencing it to check a state flag so the code sometimes worked and sometimes didn't.

Oh yes, the reproducer works as expected on macOS M1 15.4.1:


scene.width=150.0
scene.height=17.0
stage.width=150.0
stage.height=17.0
scene.width=1800.0
scene.height=1126.0
stage.width=1800.0
stage.height=1126.0
scene.width=150.0
scene.height=17.0
stage.width=150.0
stage.height=17.0


no ill effects observed in the monkey tester transitioning to/from fullscreen with iconified / maximized / normal / on top flags.

-------------

Marked as reviewed by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1799#pullrequestreview-2808392900


More information about the openjfx-dev mailing list