On Sun, 22 Mar 2026 12:16:21 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.
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add flag to disable portal file chooser

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

> 208:         // is being iterated here) but also prevents 
> gtk_window_set_transient_for from
> 209:         // being called - this causes the crash on gnome.
> 210:         gtk_window_set_transient_for((*it)->get_gtk_window(), NULL);

Is `gtk_window_set_transient_for(..., nullptr)` no longer required? I see that 
you've also remove it from `WindowContext::remove_child()`, but the relation is 
still set in `WindowContext::add_child()`.

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

> 1636:     // Double-clicking on the drag area maximizes the window (or 
> restores its size).
> 1637:     if (is_resizable() && event->type == GDK_2BUTTON_PRESS) {
> 1638:         jint hitTestResult = mainEnv->CallBooleanMethod(

You didn't change this, but here and in other places, 
`jGtkWindowNonClientHitTest` is called with `CallBooleanMethod`, but the method 
actually returns an `int`.

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

> 1689:     if (is_mouse_entered && event->type != GDK_ENTER_NOTIFY) {
> 1690:         is_mouse_entered = false;
> 1691:         mainEnv->CallVoidMethod(get_jview(), jViewNotifyMouse,

One thing to consider here: can `get_jview()` return null? In other places, we 
check; here we don't. Same question for 
`WindowContextExtended::process_mouse_motion()`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2977391448
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2977415156
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2977429149

Reply via email to