JDK-8248490 : [macOS] Undecorated stage does not minimize
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8u251,openjfx11,openjfx14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2020-06-29
  • Updated: 2020-08-25
  • Resolved: 2020-07-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8u271Fixed openjfx11.0.9Fixed
Related Reports
Relates :  
Relates :  
Description
Run the below sample on a MacOS Catalina. Setting iconified property to true has no effect on an undecorated stage.

```
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class TestApp extends Application {

    @Override
    public void start(Stage stage) {
        stage.initStyle(StageStyle.UNDECORATED);
        Button button = new Button("Minimize");
        button.setStyle("-fx-background-color: red;");
        button.setOnAction(evt -> stage.setIconified(true));
        Scene scene = new Scene(button); stage.setScene(scene);
        stage.centerOnScreen();
        stage.show();
    }
}
```

Expected
========

Pressing the button should minimize the application

Actual
========

Pressing the button does nothing
Comments
Changeset: 2f4666a7 Author: Kevin Rushforth <kcr@openjdk.org> Date: 2020-07-15 13:30:45 +0000 URL: https://git.openjdk.java.net/jfx/commit/2f4666a7
15-07-2020

This used to work in JDK 10. It seems to be related to compiling the JDK with Xcode 9 and MacOSX SDK 10.13 (irrespective of what version JavaFX is compiled with), which was done for JDK 11.
10-07-2020

[~abagarwal] Thanks for linking this to JDK-8214046. I can confirm that this is indeed the same problem for JavaFX that was fixed for AWT. Unconditionally setting NSMiniaturizableWindowMask fixes the problem. I need to run tests to check whether there are any regressions as a result, but it looks promising.
29-06-2020

I see that Sergey made the following comment in his evaluation of JDK-8214046: > After we upgrade our compilers and sdk in the JDK 11, the method NSWindow#miniaturize which we use to iconify the frame stopped working. > Now, this method pays attention to the NSMiniaturizableWindowMask flag, but we set this flag only for decorated windows(this is how we to hide the minimize button on the title).
29-06-2020

For another test case, do the following: 1. Run the Ensemble8 demo 2. Select the "Scenegraph --> Advanced Stage" sample 3. Click the "Create a Stage" button -- this will create a Transparent stage (which has the same problem as an Undecorated one) 4. Click the "Minimize me" button on the newly create stage. BUG: the stage doesn't minimize
29-06-2020

Interestingly enough, I just ran into this bug earlier today. This will save me from having to file it.
29-06-2020