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

2025-07-25 Thread Kevin Rushforth
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

Marked as reviewed by kcr (Lead).

Headful tests passed on Windows.

-

PR Review: https://git.openjdk.org/jfx/pull/1831#pullrequestreview-3055301521
PR Comment: https://git.openjdk.org/jfx/pull/1831#issuecomment-3117696892


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

2025-07-24 Thread Kevin Rushforth
On Thu, 24 Jul 2025 21:59:35 GMT, Michael Strauß  wrote:

>> modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 1165:
>> 
>>> 1163: {
>>> 1164: GlassWindow *window = getGlassWindow(env, jPtr);
>>> 1165: [window _setResizable:jResizable];
>> 
>> I presume you removed the `performSelectorOnMainThread` because the calling 
>> method always calls this on the main thread?
>
> Yes, this is a call that always happens on the FX thread as a result of 
> calling `javafx.stage.Window.show()`. This is verified just a few lines 
> earlier with `GLASS_ASSERT_MAIN_JAVA_THREAD` (that's always been there, I 
> didn't add it).

Also, the calling Java code does a thread check. So we're good.

-

PR Review Comment: https://git.openjdk.org/jfx/pull/1831#discussion_r2229693772


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

2025-07-24 Thread Kevin Rushforth
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

The headful CI tests passed on Linux and macOS (I will need to manually run it 
on Windows).

-

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


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

2025-07-24 Thread Michael Strauß
On Thu, 24 Jul 2025 21:28:43 GMT, Kevin Rushforth  wrote:

>> Michael Strauß has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   fix resizable state of macOS window
>
> modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 1165:
> 
>> 1163: {
>> 1164: GlassWindow *window = getGlassWindow(env, jPtr);
>> 1165: [window _setResizable:jResizable];
> 
> I presume you removed the `performSelectorOnMainThread` because the calling 
> method always calls this on the main thread?

Yes, this is a call that always happens on the FX thread as a result of calling 
`javafx.stage.Window.show()`. This is verified just a few lines earlier with 
`GLASS_ASSERT_MAIN_JAVA_THREAD` (that's always been there, I didn't add it).

-

PR Review Comment: https://git.openjdk.org/jfx/pull/1831#discussion_r2229665362


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

2025-07-24 Thread Kevin Rushforth
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

The code looks good. I submitted a set of headful test jobs and will report 
when done. I want to do a little light manual testing, especially on macOS 
where there are a few changes in the non-extended case (although the code looks 
equivalent).

modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Java.m line 215:

> 213: }
> 214: 
> 215: - (void)_setResizable:(bool)resizable

Good. It definitely seems cleaner to pass in resizable as a parameter rather 
than having this method be a "toggle" resizable as it was previously.

modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 1165:

> 1163: {
> 1164: GlassWindow *window = getGlassWindow(env, jPtr);
> 1165: [window _setResizable:jResizable];

I presume you removed the `performSelectorOnMainThread` because the calling 
method always calls this on the main thread?

-

PR Review: https://git.openjdk.org/jfx/pull/1831#pullrequestreview-3053397171
PR Review Comment: https://git.openjdk.org/jfx/pull/1831#discussion_r2229616697
PR Review Comment: https://git.openjdk.org/jfx/pull/1831#discussion_r2229618920


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

2025-07-23 Thread Andy Goryachev
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

modules/javafx.graphics/src/main/java/com/sun/javafx/scene/layout/HeaderButtonBehavior.java
 line 73:

> 71: 
> 72: if (type == HeaderButtonType.MAXIMIZE) {
> 73: subscription = Subscription.combine(subscription,

here and on L66 the `subscription` pointer (set in L61) gets overwritten.  does 
it mean some subscription(s) won't be cancelled in `dispose()`?

-

PR Review Comment: https://git.openjdk.org/jfx/pull/1831#discussion_r2226122084


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

2025-07-22 Thread Kevin Rushforth
On Tue, 22 Jul 2025 19:05:12 GMT, Cormac Redmond  wrote:

> I think this fix should make the 25 release if possible, as it would be 
> unfortunate to preview the new feature with distracting bugs included. The 
> fix is also quite well-tested at this point.
> 
> @kevinrushforth @andy-goryachev-oracle Do you have any review capacity to 
> spare for this within the current RDP?

Yes, I'll review it this week. It seems a good candidate for backporting to 
jfx25.

-

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


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

2025-07-22 Thread Cormac Redmond
On Tue, 22 Jul 2025 18:28:47 GMT, Michael Strauß  wrote:

> I think this fix should make the 25 release if possible, as it would be 
> unfortunate to preview the new feature with distracting bugs included. The 
> fix is also quite well-tested at this point.
> 
> @kevinrushforth @andy-goryachev-oracle Do you have any review capacity to 
> spare for this within the current RDP?

Agreed. It wouldn't take long until others come across this and raise the same 
issue.

-

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


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

2025-07-22 Thread Michael Strauß
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

I think this fix should make the 25 release if possible, as it would be 
unfortunate to preview the new feature with distracting bugs included. The fix 
is also quite well-tested at this point.

@kevinrushforth @andy-goryachev-oracle Do you have any review capacity to spare 
for this within the current RDP?

-

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


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

2025-07-07 Thread Cormac Redmond
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

FYI to any reviewer: I've been using this branch's EXTENDED/HeaderBar 
extensively now without any new issues...

-

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


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

2025-06-24 Thread Michael Strauß
On Tue, 24 Jun 2025 08:16:48 GMT, Cormac Redmond  wrote:

>> Michael Strauß has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   fix resizable state of macOS window
>
> I have found another bug/issue, which is again related to wrapping a root 
> node in a StackPane (something that is common in, for example, ControlsFx). 
> Although the observed behaviour is probably strictly logically correct, I 
> think this should be prevented (e.g, HeaderBar has/gets special 
> meaning/treatment).
> 
> 
> public class DisappearingHeaderBarNodesBug extends Application {
> 
> @Override
> public void start(Stage primaryStage) {
> BorderPane root = new BorderPane();
> Button button = new Button("Click for "bug()"!");
> button.setOnAction(_ -> bug(root));
> root.setCenter(new VBox(new Label("Something above"), button, new 
> Label("Something below")));
> root.setTop(getHeaderBar());
> 
> primaryStage.initStyle(StageStyle.EXTENDED);
> primaryStage.setScene(new Scene(root, 300, 200));
> primaryStage.show();
> }
> 
> // Wrapping the root node in a stackpane is common
> private void bug(Pane root) {
> StackPane stackPane = new StackPane();
> root.getScene().setRoot(stackPane);
> stackPane.getChildren().addFirst(root);
> }
> 
> private HeaderBar getHeaderBar() {
> HeaderBar headerBar = new HeaderBar();
> headerBar.setCenter(new Label("!!! HeaderBar !!!"));
> headerBar.setLeading(new Label("L"));
> return headerBar;
> }
> 
> public static void main(String[] args) {
> launch(args);
> }
> }
> 
> 
> As you can see, after you click the button, and resize, the HeaderBar can 
> disappear completely:
> 
> https://github.com/user-attachments/assets/93a320a5-0010-4941-a2a4-9e0e65cbd57d

@credmond We should keep this PR focused, let's use the mailing list or JBS to 
discuss other issues.

-

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


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

2025-06-24 Thread Cormac Redmond
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

I have found another bug/issue, which is again related to wrapping a root node 
in a StackPane (something that is common in, for example, ControlsFx). Although 
the observed behaviour is probably strictly logically correct, I think this 
should be prevented (e.g, HeaderBar has/gets special meaning/treatment).


public class DisappearingHeaderBarNodesBug extends Application {

@Override
public void start(Stage primaryStage) {
BorderPane root = new BorderPane();
Button button = new Button("Click for "bug()"!");
button.setOnAction(_ -> bug(root));
root.setCenter(new VBox(new Label("Something above"), button, new 
Label("Something below")));
root.setTop(getHeaderBar());

primaryStage.initStyle(StageStyle.EXTENDED);
primaryStage.setScene(new Scene(root, 300, 200));
primaryStage.show();
}

// Wrapping the root node in a stackpane is common
private void bug(Pane root) {
StackPane stackPane = new StackPane();
root.getScene().setRoot(stackPane);
stackPane.getChildren().addFirst(root);
}

private HeaderBar getHeaderBar() {
HeaderBar headerBar = new HeaderBar();
headerBar.setCenter(new Label("!!! HeaderBar !!!"));
headerBar.setLeading(new Label("L"));
return headerBar;
}

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


As you can see, after you click the button, and resize, the HeaderBar can 
disappear completely:

https://github.com/user-attachments/assets/93a320a5-0010-4941-a2a4-9e0e65cbd57d

-

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


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

2025-06-22 Thread Markus Mack
On Sat, 21 Jun 2025 23:37:13 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:
> 
>   fix resizable state of macOS window

Changes look good, all combinations that I've tested manually seem to work fine 
now. I also tested with gnome & KDE this time.

-

Marked as reviewed by mmack (Author).

PR Review: https://git.openjdk.org/jfx/pull/1831#pullrequestreview-2948272405


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

2025-06-21 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:

  fix resizable state of macOS window

-

Changes:
  - all: https://git.openjdk.org/jfx/pull/1831/files
  - new: https://git.openjdk.org/jfx/pull/1831/files/20eac39e..cd550b4b

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

  Stats: 43 lines in 3 files changed: 7 ins; 13 del; 23 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