JDK-8298499 : Stacking order sometimes wrong on Linux when setting always-on-top for two Stages
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: openjfx19
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2022-12-09
  • Updated: 2022-12-12
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
This was discovered when trying to figure out why IconifyTest fails intermittently on Linux (see JDK-8298496).

It appears that there is an intermittent (or, on some distros, not-so-intermittent) bug when showing two stages that are both always-on-top. The expectation is that if there is more than one Stage that is always-on-top, they will be stacked in the order they were created. It seems like this isn't always the case. The IconifyTest program creates a "bottom" and a "top" stages with both set to always-on-top and expects them to be stacked in order of creation, with the most recently created Stage on top. We will fix IconfiyTest to not rely on this, but the underlying problem remains.

To reproduce this, run the attached test case.
Comments
I have done some testing on the "on top" code and it seems that it can be simplified because the gnome window manager already handles children of the "on top" window. I suspect that it was not the reality when it was implemented. So, apart of this bug, we could simplify it by just calling gtk_window_set_keep_above. Btw, this is not available on gtk4.
12-12-2022

I had a look on this, `gtk_window_set_keep_above` sets `_NET_WM_STATE_ABOVE` and it's up to the window manager how to handle this. The gnome default seems to not care about creation/stacking order of "above windows". There is probably a way to do this, but won't be beautiful.
12-12-2022

NOTE: the test should be converted to JUnit5 and parameterized to test combinations of top and bottom stage style of {DECORATED,UNDECORATED,TRANSPARENT}.
09-12-2022