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

Lukasz Kostyra lkostyra at openjdk.org
Wed Sep 10 15:46:53 UTC 2025


On Wed, 10 Sep 2025 13:31:19 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> 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 with a new target base due to a merge or a rebase. The pull request now contains 73 commits:
> 
>  - Merge branch 'master' into 8354943
>  - - Fix scene resize when window is unresizable
>  - - Fix "Incomplete attachment. (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)(FBO - 820)" when changing view
>  - - Fix tests
>  - - Fix FOCUS_LOST begin sent on focused windows
>  - - Remove CenterOnScreenTest.java
>  - Merge branch 'master' into 8354943
>  - - Fix (SetSceneScalingTest)
>  - - Fix mistake (assertTrue -> assumeTrue)
>  - - Add hint about macOS beeps
>    - Disable some tests on specific platforms
>  - ... and 63 more: https://git.openjdk.org/jfx/compare/3e376e66...8bc6c4b6

I've been going through the review and tests here, I still have some more code to review but I did notice there are some test failures on Windows:

StageOwnershipTest. openingModalChildStageWhileFullScreenShouldHaveFocus(StageStyle, Modality) [3] UNDECORATED, APPLICATION_MODAL
StageOwnershipTest. openingModalChildStageWhileFullScreenShouldHaveFocus(StageStyle, Modality) [4] UNDECORATED, WINDOW_MODAL
StageOwnershipTest. openingModalChildStageWhileFullScreenShouldHaveFocus(StageStyle, Modality) [5] EXTENDED, APPLICATION_MODAL
StageOwnershipTest. openingModalChildStageWhileFullScreenShouldHaveFocus(StageStyle, Modality) [6] EXTENDED, WINDOW_MODAL
StageOwnershipTest. openingModalChildStageWhileMaximizedShouldNotUnmaximize(StageStyle, Modality) [3] UNDECORATED, APPLICATION_MODAL
StageOwnershipTest. openingModalChildStageWhileMaximizedShouldNotUnmaximize(StageStyle, Modality) [4] UNDECORATED, WINDOW_MODAL
StageOwnershipTest. openingModalChildStageWhileMaximizedShouldNotUnmaximize(StageStyle, Modality) [5] EXTENDED, APPLICATION_MODAL
StageOwnershipTest. openingModalChildStageWhileMaximizedShouldNotUnmaximize(StageStyle, Modality) [6] EXTENDED, WINDOW_MODAL 


One StageOwnershipTest - `iconifyParentShouldHideChildren [DECORATED]` - also consistently fails on my Ubuntu 24.04.2 VM.

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

PR Comment: https://git.openjdk.org/jfx/pull/1789#issuecomment-3275531952


More information about the openjfx-dev mailing list