On Sat, 20 Sep 2025 10:00:38 GMT, Thiago Milczarek Sayao <[email protected]> 
wrote:

>> This is a continuation to 
>> [JDK-8236651](https://bugs.openjdk.org/browse/JDK-8236651) and it aims to 
>> stabilize the linux glass gtk backend.
>> 
>> This is a refactor of the Glass GTK implementation, primarily focused on 
>> window size, positioning, and state management to resolve numerous issues.
>> 
>> The main change is that GtkWindow (which is a GtkWidget) has been replaced 
>> with a direct use of GdkWindow for windows. This makes sense because GTK 
>> includes its own rendering pipeline, whereas JavaFX renders directly to the 
>> underlying system window (such as the X11 window) via Prism ES2 using GL and 
>> GLX. Most GTK window-related calls have equivalent GDK calls. Since GDK 
>> serves as an abstraction over the system window and input events, it aligns 
>> better with the purposes of Glass. Additionally, using GTK required various 
>> workarounds to integrate with Glass, which are no longer necessary when 
>> using GDK directly.
>> 
>> It uses a simple C++ Observable to notify the Java side about changes. This 
>> approach is more straightforward, as notifications occur at many points and 
>> the previous implementation was becoming cluttered.
>> 
>> Previously, there were three separate context classes, two of which were 
>> used for Java Web Start and Applets. These have now been unified, as they 
>> are no longer required.
>> 
>> Many tests were added to ensure everything is working correctly. I noticed 
>> that some tests produced different results depending on the StageStyle, so 
>> they now use @ParameterizedTest to vary the StageStyle.
>> 
>> A manual test is also provided. I did not use MonkeyTester for this, as it 
>> was quicker to simply run and test manually:`java @build/run.args 
>> tests/manual/stage/TestStage.java `
>> 
>> While this is focused on XWayland, everything works on pure Xorg as well.
>> 
>> List of fixed issues:
>> 
>> 1. [[Linux] Stage.setMaximized() before show() does not 
>> persist](https://bugs.openjdk.org/browse/JDK-8316425)
>> 3. [[Linux] Intermittent test failure in 
>> IconifyTest.canIconifyDecoratedStage](https://bugs.openjdk.org/browse/JDK-8316891)
>> 4. [[Linux] Initial window position is not centered on Ubuntu 24.04 / 
>> Xorg](https://bugs.openjdk.org/browse/JDK-8337400)
>> 5. [[Linux] Some of the SizeToSceneTest fail in Ubuntu 
>> 24.04](https://bugs.openjdk.org/browse/JDK-8353612)
>> 6. [[Linux] View size glitch when resizing past max window 
>> size](https://bugs.openjdk.org/browse/JDK-8355073)
>> 7. [RestoreSceneSizeTest fails in Ubuntu 
>> 24.04](https://bugs.openjdk.org/browse/JDK-8353556)
>> 8. [DualWindowTest...
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Revert "8367898: Skip StageFocusTest on Linux"
>   
>   This reverts commit c95cdcdc9cd8b3070e8076ea91234772d6a21331.

Code in general looks good (minus one extraneous copyright header) however I 
did catch more failures when testing on our CI.

Mac machines fail these headful tests consistently (I suspect this is some sort 
of mistake like on Windows where decorations are not taken into account):

SizingTest > maxHeight(StageStyle) > maxHeight(StageStyle) [5] EXTENDED FAILED
    org.opentest4j.AssertionFailedError: Stage height should have been limited 
to max height ==> expected: <350.0> but was: <366.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.maxHeight(SizingTest.java:151)

SizingTest > minHeight(StageStyle) > minHeight(StageStyle) [5] EXTENDED FAILED
    org.opentest4j.AssertionFailedError: Stage height should have been limited 
to min height ==> expected: <500.0> but was: <516.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.minHeight(SizingTest.java:215)

SizingTest > maxSize(StageStyle) > maxSize(StageStyle) [5] EXTENDED FAILED
    org.opentest4j.AssertionFailedError: Stage height should have been limited 
to max height ==> expected: <350.0> but was: <366.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.maxSize(SizingTest.java:95)

SizingTest > minSize(StageStyle) > minSize(StageStyle) [1] DECORATED FAILED
    org.opentest4j.AssertionFailedError: Stage width should have been limited 
to min width ==> expected: <500.0> but was: <450.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.minSize(SizingTest.java:175)

SizingTest > minSize(StageStyle) > minSize(StageStyle) [2] UNDECORATED FAILED
    org.opentest4j.AssertionFailedError: Stage width should have been limited 
to min width ==> expected: <500.0> but was: <450.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.minSize(SizingTest.java:175)

SizingTest > minSize(StageStyle) > minSize(StageStyle) [3] TRANSPARENT FAILED
    org.opentest4j.AssertionFailedError: Stage width should have been limited 
to min width ==> expected: <500.0> but was: <450.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.minSize(SizingTest.java:175)

SizingTest > minSize(StageStyle) > minSize(StageStyle) [4] UTILITY FAILED
    org.opentest4j.AssertionFailedError: Stage width should have been limited 
to min width ==> expected: <500.0> but was: <450.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.minSize(SizingTest.java:175)

SizingTest > minSize(StageStyle) > minSize(StageStyle) [5] EXTENDED FAILED
    org.opentest4j.AssertionFailedError: Stage width should have been limited 
to min width ==> expected: <500.0> but was: <450.0>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:86)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1024)
        at app//test.javafx.stage.SizingTest.minSize(SizingTest.java:175)


On Ubuntu there also were two failures:

StageAttributesTest > testIconifiedStageBeforeShow(StageStyle) > 
testIconifiedStageBeforeShow(StageStyle) [2] UNDECORATED FAILED
    org.opentest4j.AssertionFailedError: expected:rgba(0,255,0,255) but 
was:rgba(255,0,0,255)
        at 
app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
        at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:138)
        at 
app//test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:168)
        at 
app//test.robot.javafx.stage.StageAttributesTest.lambda$testIconifiedStageBeforeShow$1(StageAttributesTest.java:233)


IconifyTest > canIconifyDecoratedStage() FAILED
    org.opentest4j.AssertionFailedError: expected:rgba(255,0,0,255) but 
was:rgba(0,215,0,255)
        at 
app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
        at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:138)
        at 
app//test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:168)
        at 
app//test.robot.javafx.stage.IconifyTest.lambda$canIconifyStage$8(IconifyTest.java:123)

These are existing tests that were un-skipped, but it seems there is still some 
issues with them.

tests/manual/stage/TestStage.java line 25:

> 23:  * questions.
> 24:  */
> 25: /*

This file ended up with two same copyright headers, I think we can only keep 
one :)

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

PR Review: https://git.openjdk.org/jfx/pull/1789#pullrequestreview-3257725418
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2372137425

Reply via email to