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

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

On Fri, 10 Jul 2020 18:23:58 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> 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.

On a related note, even after this fix, an undecorated window cannot be restored (deminiaturized) programmatically.
This is not related and is not a regression. I filed [JDK-8249202](https://bugs.openjdk.java.net/browse/JDK-8249202) to
track this as a follow-up issue.


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

More information about the openjfx-dev mailing list