RFR: 8359601: Fix window button states of an extended stage
Michael Strauß
mstrauss at openjdk.org
Sun Jun 15 20:06:11 UTC 2025
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 match the table above.
3. The stylesheets for GNOME and KDE are changed such that disabled buttons are hidden.
4. The stylesheet for Windows is changed such that a modal/non-resizable window looks like a utility window.
-------------
Commit messages:
- Fix disabled states of custom window buttons
- Fix disabled/hidden states of default window buttons
- Remove unused window modality code
Changes: https://git.openjdk.org/jfx/pull/1831/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1831&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8359601
Stats: 469 lines in 18 files changed: 181 ins; 254 del; 34 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
More information about the openjfx-dev
mailing list