On Sun, 15 Mar 2026 17:19:14 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 with a new target base 
> due to a merge or a rebase. The pull request now contains 93 commits:
> 
>  - Merge master
>  - Merge branch 'master' into 8354943
>    
>    # Conflicts:
>    #  modules/javafx.graphics/src/main/native-glass/gtk/GlassCommonDialogs.cpp
>  - Make TestStage more organized
>  - Let view sizes update with it's own path
>  - Fix sizing issues
>  - Review fixes
>  - sync headerbar changes
>  - Merge branch 'master' into 8354943
>    
>    # Conflicts:
>    #  modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp
>    #  modules/javafx.graphics/src/main/native-glass/gtk/glass_window.h
>  - Merge branch 'master' into 8354943
>    
>    # Conflicts:
>    #  tests/system/src/test/java/test/util/Util.java
>  - Merge branch 'master' into 8354943
>  - ... and 83 more: https://git.openjdk.org/jfx/compare/0b8ddccc...adb43ade

#2025 currently uses `gtk_file_chooser_native_new`, which only works with a ` 
GtkWindow` as a parent. This breaks this PR because it works with `GdkWindow` 
instead of a `GtkWindow`  (because we don’t use Gtk for rendering).

It works on GNOME because the native window will be a `GtkWindow`. On KDE, it 
works but issues a warning, and the window won’t be transient-for.

On my machine (Fedora 43) with #2025, the GNOME file chooser does not open, 
which I actually prefer:

The Gnome file open dialog:
<img width="1880" height="1200" alt="image" 
src="https://github.com/user-attachments/assets/0a3a1cdb-8c17-4f30-b759-a6a499be2d09";
 />

This is the file open dialog which 
`[Gtk.FileChooserNative](https://docs.gtk.org/gtk3/class.FileChooserNative.html)`
 uses:
<img width="3338" height="1600" alt="image" 
src="https://github.com/user-attachments/assets/506d6a0b-b895-4306-82c5-90c9574b528d";
 />

I may submit a PR using `DBus` directly, so the GNOME file chooser opens, 
preserving the desktop look and supporting transient-for.

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

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

Reply via email to