[jfx15] RFR: 8248490: [macOS] Undecorated stage does not minimize

Kevin Rushforth kcr at openjdk.java.net
Fri Jul 10 21:33:07 UTC 2020


When running a JavaFX application on macOS using a JDK compiled with the MacOSX 10.13 SDK or later, an undecorated or
transparent stage cannot be programmatically minimized (iconified). The reason for this failure is that JavaFX only
sets the `NSMiniaturizableWindowMask` bit in the `styleMask` of the `NSWindow` for decorated windows. Previous versions
of the MacOSX SDK would minimize and restore a windows regardless of the setting of this flag. When the application is
compiled against a newer SDK, Apple honors that flag and prevents the window from being minimized.

Note that it is the version of the SDK used to compile the JDK and not the version that is used to compile JavaFX that
exposes this bug.

The fix is to temporarily set the `NSMiniaturizableWindowMask` prior to calling `miniaturize` or `deminiaturize`, and
restore it afterwards. This seems safer than setting the bit unconditionally when the NSWindow is created, which would
have been another approach.

A similar fix was done for AWT. See [JDK-8214046](https://bugs.openjdk.java.net/browse/JDK-8214046).

I propose to fix this in JavaFX 15, so it it targeted to the `jfx15` branch.

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

Commit messages:
 - 8248490: [macOS] Undecorated stage does not minimize

Changes: https://git.openjdk.java.net/jfx/pull/264/files
 Webrev: https://webrevs.openjdk.java.net/jfx/264/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8248490
  Stats: 135 lines in 2 files changed: 134 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jfx/pull/264.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/264/head:pull/264

PR: https://git.openjdk.java.net/jfx/pull/264


More information about the openjfx-dev mailing list