On Mon, 30 Jun 2025 10:39:00 GMT, Thiago Milczarek Sayao <tsa...@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 58 commits:
> 
>  - Remove repaint call (8351867 is fixed)
>  - Merge branch 'master' into 8354943
>  - Remove unused const
>  - Remove wrong call to enter_fullscreen
>  - Review changes
>  - Use process_expose
>  - Min / Max size improvements
>  - Invalidate view size on new view
>  - Re-allow fullscreen on child
>  - Test fixes for mac + typo
>  - ... and 48 more: https://git.openjdk.org/jfx/compare/0270847b...016ff681

This is quite a big change but after the first pass it seems to be quite good. 
I left only a couple minor comments, but I will have to do more "passes" on 
this PR (especially through the tests which I only loosely glanced on).

As such, two requests for this PR for now:
1. This PR fixes quite a bit of issues we had with Linux that were reported, 
they are listed in the PR description. Can you link all of them via Skara's 
`/issue add <JDK-ID>` so that they get resolved once this PR goes through? I 
think you should be able to link all issues within one command so `/issue add 
JDK-ID,JDK-ID,...`
2. Can you merge latest master? We recently updated used JDK and Gradle version 
and this PR still lags behind on old ones which collides with test runs.

I also did an initial test run, I did get quite a bit of failures (Ubuntu 
24.04.2 LTS VM, Gnome 46 on Wayland, 91 total tests failing; to name a few 
prominent groups that fail - `TextCharacterIndexTest`, 
`TextFlowSurrogatePairInsertionIndexTest`, `RegionBackgroundFillUITest`, 
`RegionBackgroundImageUITest`) but I'm not sure if those also fail on master 
yet - I'll re-check after the master merge.

modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp line 1036:

> 1034: void WindowContext::notify_fullscreen(bool enter) {
> 1035:     if (enter) {
> 1036:         LOG("com_sun_glass_events_ViewEvent_FULLSCREEN_ENTER\n");

This could be simplified to


LOG("com_sun_glass_events_ViewEvent_FULLSCREEN_%s\n", enter ? "ENTER" : "EXIT");
mainEnv->CallVoidMethod(jview, jViewNotifyView, enter ? 
com_sun_glass_events_ViewEvent_FULLSCREEN_ENTER : 
com_sun_glass_events_ViewEvent_FULLSCREEN_EXIT);
CHECK_JNI_EXCEPTION(mainEnv)

modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp line 1359:

> 1357: }
> 1358: 
> 1359: // This only works o Xorg

Minor: "works o" -> "works on"

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

PR Review: https://git.openjdk.org/jfx/pull/1789#pullrequestreview-3039031659
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2225189967
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2225228459

Reply via email to