Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8176813

Mac: Failure to exit full-screen programmatically in some cases



    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, 9
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:


      There are two problems that can happen when programmatically entering and then exiting full-screen mode. They are likely related to each other, so I am filing one bug for both symptoms. We can split one of the two out into a separate bug later if necessary.

      Symptom #1 -- stage.setFullScreen(false) will not exit full-screen if done before the window has finished the animation for expanding the window to fill the screen.

      To reproduce this, run the existing test.javafx.stage.RestoreStagePositionTest#testUfullscreenPosition unit test. Because of the short sleep time between submitting the runLater that enters full-screen and submitting the runLater that exits full-screen, the exit is called before the animation is done. It seems that glass does not handle this case gracefully. The window will fail to exit full-screen mode and the test will fail.

      java.lang.AssertionError: Assertion failed: excpected 300.0, was: 0.0
      at RestoreStagePositionTest2.fail(RestoreStagePositionTest2.java:62)
      at RestoreStagePositionTest2.assertEquals(RestoreStagePositionTest2.java:78)
      at RestoreStagePositionTest2.testUfullscreenPosition(RestoreStagePositionTest2.java:141)
      at RestoreStagePositionTest2.main(RestoreStagePositionTest2.java:52)

      Symptom #2 -- stage.setFullScreen(false) will cause an NPE in leaveNestedEventLoop if done after the window has finished the animation for expanding the window to fill the screen.

      To reproduce this, modify the "Thread.sleep(400)" to "Thread.sleep(2000)" and run the test. It may be necessary to click in the window before the exception is delivered.

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at javafx.graphics/com.sun.glass.ui.Application.leaveNestedEventLoop(Application.java:540)
      at javafx.graphics/com.sun.glass.ui.mac.MacApplication._enterNestedEventLoopImpl(Native Method)
      at javafx.graphics/com.sun.glass.ui.mac.MacApplication._enterNestedEventLoop(MacApplication.java:109)
      at javafx.graphics/com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511)
      at javafx.graphics/com.sun.glass.ui.mac.MacView._exitFullscreen(Native Method)
      at javafx.graphics/com.sun.glass.ui.View.exitFullscreen(View.java:792)
      at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.applyFullScreen(WindowStage.java:720)
      at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.setFullScreen(WindowStage.java:756)
      at javafx.graphics/javafx.stage.Stage.setFullScreen(Stage.java:666)
      at RestoreStagePositionTest2.lambda$testUfullscreenPosition$4(RestoreStagePositionTest2.java:136)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(PlatformImpl.java:418)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:417)
      at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)


          Issue Links



              Unassigned Unassigned
              kcr Kevin Rushforth
              0 Vote for this issue
              4 Start watching this issue