Re: RFR: 8359601: Fix window button states of an extended stage [v2]

2025-06-16 Thread Cormac Redmond
On Tue, 17 Jun 2025 00:38:31 GMT, Michael Strauß  wrote:

> Good catch, a non-modal owned window also can't be iconified. I've added code 
> and tests for this scenario.

Looks good, can't find anymore issues...

-

PR Comment: https://git.openjdk.org/jfx/pull/1831#issuecomment-2978613337


Re: RFR: 8359601: Fix window button states of an extended stage [v2]

2025-06-16 Thread Cormac Redmond
On Tue, 17 Jun 2025 00:37:22 GMT, Cormac Redmond  wrote:

> Another suspected issue (not really related to this PR), close request 
> handlers are not called when using EXTENDED. E.g.:
> 
> ```
> stage.setOnCloseRequest(event -> {
> System.out.println("Never called...");;
> });
> ```
> 
> Same for dialogs...

Sample:


import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class MinimiseIconEnabledBug extends Application {
@Override
public void start(Stage primaryStage) {
Button button = new Button("Click");
button.setOnAction(e -> {
final Dialog dialog = new Dialog<>();
dialog.initOwner(primaryStage);
// dialog.initStyle(StageStyle.EXTENDED); // uncomment for bug
dialog.initModality(Modality.NONE);
dialog.setResizable(true); // This is important
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
dialog.setOnCloseRequest(dialogEvent -> {
System.out.println("Close the dialog pane. This is not called 
when EXTENDED is used.");
});
dialog.show();
});

StackPane root = new StackPane(button);
Scene scene = new Scene(root, 300, 200);
primaryStage.setScene(scene);
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}
}

-

PR Comment: https://git.openjdk.org/jfx/pull/1831#issuecomment-2978574395


Re: RFR: 8359601: Fix window button states of an extended stage [v2]

2025-06-16 Thread Cormac Redmond
On Tue, 17 Jun 2025 00:23:48 GMT, Michael Strauß  wrote:

>> The window button states (disabled/hidden) of extended stages with a 
>> `HeaderButtonOverlay` or custom header buttons are inconsistent with what we 
>> would expect from the OS (Windows and Linux). To figure out what we would 
>> expect, I started with gathering some data. The following table shows the 
>> button states of system-decorated windows on various platforms:
>> 
>>  Windows 11
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | visible | visible | visible |
>> | not resizable, not modal | visible | visible, disabled | visible |
>> | resizable, modal | visible, disabled | visible | visible |
>> | not resizable, modal | hidden | hidden | visible, utility-style |
>> 
>>  Ubuntu 24 / Fedora 41 (GNOME)
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | visible | visible | visible |
>> | not resizable, not modal | visible | hidden | visible |
>> | resizable, modal | visible, _not working_ | visible, _not working_ | 
>> visible |
>> | not resizable, modal | visible, _not working_ | hidden | visible |
>> 
>>  Kubuntu 24 (KDE)
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | visible | visible | visible |
>> | not resizable, not modal | visible | hidden | visible |
>> | resizable, modal | visible, _not working_ | visible | visible |
>> | not resizable, modal | visible, _not working_ | hidden | visible |
>> 
>> ## Observations
>> 
>> 1. On Windows, buttons are generally disabled when their operation is not 
>> possible with the given window attributes.
>>* Exception: modal/non-resizable windows look like utility windows 
>> (iconify and maximize are hidden)
>> 2. On GNOME and KDE, buttons are generally hidden when their operation is 
>> not possible.
>>* Exception: iconify and maximize on modal windows is not hidden, but 
>> seems to simply not do anything (bug?)
>> 
>> ## Permitted window button operations
>> 
>> Given the gathered observations and some simple logic, this is the table of 
>> operations that are permitted for all combinations of modal and resizable 
>> window attributes:
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | yes | yes | yes |
>> | not resizable, not modal | yes | no | yes |
>> | resizable, modal | no | yes | yes |
>> | not resizable, modal | no | no | yes |
>> 
>> ## Fixes
>> 
>> This PR includes the following changes:
>> 1. Unused code relating to window modality is removed...
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Handle non-modal owned window correctly

Another suspected issue (not really related to this PR), close request handlers 
are not called when using EXTENDED. E.g.:


stage.setOnCloseRequest(event -> {
System.out.println("Never called...");;
});


Same for dialogs...

-

PR Comment: https://git.openjdk.org/jfx/pull/1831#issuecomment-2978564173


Re: RFR: 8359601: Fix window button states of an extended stage [v2]

2025-06-16 Thread Michael Strauß
On Tue, 17 Jun 2025 00:23:48 GMT, Michael Strauß  wrote:

>> The window button states (disabled/hidden) of extended stages with a 
>> `HeaderButtonOverlay` or custom header buttons are inconsistent with what we 
>> would expect from the OS (Windows and Linux). To figure out what we would 
>> expect, I started with gathering some data. The following table shows the 
>> button states of system-decorated windows on various platforms:
>> 
>>  Windows 11
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | visible | visible | visible |
>> | not resizable, not modal | visible | visible, disabled | visible |
>> | resizable, modal | visible, disabled | visible | visible |
>> | not resizable, modal | hidden | hidden | visible, utility-style |
>> 
>>  Ubuntu 24 / Fedora 41 (GNOME)
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | visible | visible | visible |
>> | not resizable, not modal | visible | hidden | visible |
>> | resizable, modal | visible, _not working_ | visible, _not working_ | 
>> visible |
>> | not resizable, modal | visible, _not working_ | hidden | visible |
>> 
>>  Kubuntu 24 (KDE)
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | visible | visible | visible |
>> | not resizable, not modal | visible | hidden | visible |
>> | resizable, modal | visible, _not working_ | visible | visible |
>> | not resizable, modal | visible, _not working_ | hidden | visible |
>> 
>> ## Observations
>> 
>> 1. On Windows, buttons are generally disabled when their operation is not 
>> possible with the given window attributes.
>>* Exception: modal/non-resizable windows look like utility windows 
>> (iconify and maximize are hidden)
>> 2. On GNOME and KDE, buttons are generally hidden when their operation is 
>> not possible.
>>* Exception: iconify and maximize on modal windows is not hidden, but 
>> seems to simply not do anything (bug?)
>> 
>> ## Permitted window button operations
>> 
>> Given the gathered observations and some simple logic, this is the table of 
>> operations that are permitted for all combinations of modal and resizable 
>> window attributes:
>> 
>> | Window attributes | Iconify | Maximize | Close |
>> |---|---|---|---|
>> | resizable, not modal | yes | yes | yes |
>> | not resizable, not modal | yes | no | yes |
>> | resizable, modal | no | yes | yes |
>> | not resizable, modal | no | no | yes |
>> 
>> ## Fixes
>> 
>> This PR includes the following changes:
>> 1. Unused code relating to window modality is removed...
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Handle non-modal owned window correctly

Good catch, a non-modal owned window also can't be iconified. I've added code 
and tests for this scenario.

-

PR Comment: https://git.openjdk.org/jfx/pull/1831#issuecomment-2978566477


Re: RFR: 8359601: Fix window button states of an extended stage [v2]

2025-06-16 Thread Michael Strauß
> The window button states (disabled/hidden) of extended stages with a 
> `HeaderButtonOverlay` or custom header buttons are inconsistent with what we 
> would expect from the OS (Windows and Linux). To figure out what we would 
> expect, I started with gathering some data. The following table shows the 
> button states of system-decorated windows on various platforms:
> 
>  Windows 11
> 
> | Window attributes | Iconify | Maximize | Close |
> |---|---|---|---|
> | resizable, not modal | visible | visible | visible |
> | not resizable, not modal | visible | visible, disabled | visible |
> | resizable, modal | visible, disabled | visible | visible |
> | not resizable, modal | hidden | hidden | visible, utility-style |
> 
>  Ubuntu 24 / Fedora 41 (GNOME)
> 
> | Window attributes | Iconify | Maximize | Close |
> |---|---|---|---|
> | resizable, not modal | visible | visible | visible |
> | not resizable, not modal | visible | hidden | visible |
> | resizable, modal | visible, _not working_ | visible, _not working_ | 
> visible |
> | not resizable, modal | visible, _not working_ | hidden | visible |
> 
>  Kubuntu 24 (KDE)
> 
> | Window attributes | Iconify | Maximize | Close |
> |---|---|---|---|
> | resizable, not modal | visible | visible | visible |
> | not resizable, not modal | visible | hidden | visible |
> | resizable, modal | visible, _not working_ | visible | visible |
> | not resizable, modal | visible, _not working_ | hidden | visible |
> 
> ## Observations
> 
> 1. On Windows, buttons are generally disabled when their operation is not 
> possible with the given window attributes.
>* Exception: modal/non-resizable windows look like utility windows 
> (iconify and maximize are hidden)
> 2. On GNOME and KDE, buttons are generally hidden when their operation is not 
> possible.
>* Exception: iconify and maximize on modal windows is not hidden, but 
> seems to simply not do anything (bug?)
> 
> ## Permitted window button operations
> 
> Given the gathered observations and some simple logic, this is the table of 
> operations that are permitted for all combinations of modal and resizable 
> window attributes:
> 
> | Window attributes | Iconify | Maximize | Close |
> |---|---|---|---|
> | resizable, not modal | yes | yes | yes |
> | not resizable, not modal | yes | no | yes |
> | resizable, modal | no | yes | yes |
> | not resizable, modal | no | no | yes |
> 
> ## Fixes
> 
> This PR includes the following changes:
> 1. Unused code relating to window modality is removed.
> 2. The disabled states of `HeaderButtonOverlay` as well as 
> `HeaderButtonBehavior` are changed to mat...

Michael Strauß has updated the pull request incrementally with one additional 
commit since the last revision:

  Handle non-modal owned window correctly

-

Changes:
  - all: https://git.openjdk.org/jfx/pull/1831/files
  - new: https://git.openjdk.org/jfx/pull/1831/files/b3d7ae62..06a0a5bb

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1831&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1831&range=00-01

  Stats: 60 lines in 4 files changed: 42 ins; 1 del; 17 mod
  Patch: https://git.openjdk.org/jfx/pull/1831.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1831/head:pull/1831

PR: https://git.openjdk.org/jfx/pull/1831