RFR: 8176813: Mac: Failure to exit full-screen programmatically in some cases [v3]

Kevin Rushforth kcr at openjdk.org
Wed Apr 30 21:28:52 UTC 2025


On Wed, 30 Apr 2025 03:38:34 GMT, Martin Fox <mfox at openjdk.org> wrote:

>> On macOS the system animates the transition into and out of fullscreen and this animation runs asynchronously. JavaFX tries to make the setFullScreen call appear synchronous by running a nested event loop while the transition is going on. But this means that runLater runnables can fire during a call to setFullScreen.
>> 
>> This can also occur during a call to Window.hide() if the window is in fullscreen mode. During the setView call glass tries to take the window out of fullscreen mode which fires up a nested event loop and, again, runLater runnables (like pulses) start firing.
>> 
>> In this PR GlassRunnables that try to run during the fullscreen transition are instead placed in a deferral list. When the fullscreen event loop exits they are re-scheduled.
>
> Martin Fox has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Bumping up delay to ensure fullscreen transition is done on macOS

During the headful test run, the following test failed on all four of our test systems, so it is likely related to your fix.


RestoreStagePositionTest > testDemaximizedPosition() FAILED
    org.opentest4j.AssertionFailedError: Window was moved ==> expected: <400.0> but was: <424.0>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.RestoreStagePositionTest.testDemaximizedPosition(RestoreStagePositionTest.java:152)


I note that the x64 systems had a different actual value (450), which is probably related to screen resolution or visible bounds of the system.

This was on the maximize / demaximize test. There is a full screen test in the same test class.

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

PR Comment: https://git.openjdk.org/jfx/pull/1797#issuecomment-2843322511


More information about the openjfx-dev mailing list