RFR: 8354943: [Linux] Simplify and update glass gtk backend: window sizing, positioning, and state management issues [v5]

Thiago Milczarek Sayao tsayao at openjdk.org
Thu Apr 24 22:34:04 UTC 2025


On Thu, 24 Apr 2025 16:05:11 GMT, Martin Fox <mfox at openjdk.org> wrote:

>> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reenable RestoreSceneSizeTest (JDK-8353556)
>
> tests/system/src/test/java/test/javafx/stage/SizingTest.java line 136:
> 
>> 134:             mode = EnumSource.Mode.INCLUDE,
>> 135:             names = {"DECORATED", "UNDECORATED", "TRANSPARENT"})
>> 136:     void testMaximizeMaxSize(StageStyle stageStyle) {
> 
> This test assumes that maximizing a window will ignore the max size settings. That's not how it works on macOS and it would be a bear to try to implement this. I think we should remove this test.

I actually worked around by removing the constraints, maximize and restore back the constraints when unmaximized. Window does allow this. I would prefer to not allow as well and invert the test (or remove it).

> tests/system/src/test/java/test/javafx/stage/SizingTest.java line 262:
> 
>> 260:             mode = EnumSource.Mode.INCLUDE,
>> 261:             names = {"DECORATED", "UNDECORATED", "TRANSPARENT", "UTILITY"})
>> 262:     void testMinSize(StageStyle stageStyle) {
> 
> Yikes! This test uncovers a long-standing problem and is failing on macOS and Windows. In general glass will only send a resize notification if the window's size actually changes. When you set the width and height here JavaFX records the new values, sends them on to glass, and glass doesn't respond because the window size doesn't change. The property values do not get corrected to reflect the actual window size and the test fails.
> 
> (I am not a fan of the JavaFX property-based API for setting window attributes. Basically JavaFX records an attribute change as if it has already happened and THEN sends it on to glass to be acted on. This creates endless complications like this.)

I had to work around this. It's a little worse, because if the Stage is fullscreen and we call setWitdth, for example, JavaFX will imediatelly set the width (but the Stage is fullscreen!).

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2059329764
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2059327365


More information about the openjfx-dev mailing list