On Sat, 21 Jun 2025 14:45:25 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.
>> 
>> 
>> Overall, it has been made more robust within its scope, particularly in 
>> terms of sizing, positioning, and state management.
>> 
>> List of changes:
>> 1. Use GDK for creating Windows. Since we paint directly to the underlying 
>> XWindow, creating a GtkWidget for the window is unnecessary and results in 
>> unused GTK resources. Additionally, avoiding the use of a GtkWidget 
>> eliminates the need for workarounds caused by conflicting GTK behavior—such 
>> as setting the initial window state, position, or size.  It's work-around 
>> free.
>> 3. It aligns with X11's asynchronous behavior by reporting geometry changes 
>> only upon receiving a configure event, since requests to the window manager 
>> aren't guaranteed to be honored. However, changes are still reported 
>> immediately in special cases, such as before the window is mapped. For 
>> example, a request to move the window to (0, 0) might be overridden by the 
>> window manager, placing it in the top-right corner below the panels instead.
>> 4. States (fullscreen, maximized and iconify) are now reported back to Java 
>> when it actually happens rather than immediately (except when not mapped);
>> 5. When a window is maximized, it will ignore geometry changes and restore 
>> to the geometry it had prior to being maximized. After some testing, I 
>> believe this is the best behavior for platform compatibility;
>> 6. Unifies the WindowContext class: previously, there were three separate 
>> classes—two of which (for applets and Java Web Start) were removed, leaving 
>> only one. However, the supporting infrastructure was still there partially. 
>> [Unify WindowContext in 
>> glass-gtk](https://bugs.openjdk.org/browse/JDK-8305768)
>> 7. Tests were added and re-enabled to ensure everything works correctly. The 
>> stage tests now cover various StageStyle configurations, as I found that 
>> `DECORATED` stages often behave differently from `UNDECORATED` or `UTILITY` 
>> stages;
>> 8. Added Logs for debugging. Enable it with ` -PCONF=DebugNative`;
>> 9. Old work-arounds dating back to Ubuntu 16.04 with Compiz were removed. 
>> 
>> A simple manual test is provided:
>> `java @build/run.args tests/manual/stage/TestStage.java `
>> 
>> 
>> 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...
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Use process_expose

modules/javafx.graphics/src/main/java/com/sun/glass/ui/gtk/GtkView.java line 
103:

> 101:     private native void _uploadPixelsIntArray(long viewPtr, int[] 
> pixels, int offset, int width, int height);
> 102: 
> 103:     protected native void enterFullscreenImpl(long ptr, boolean animate, 
> boolean keepRatio, boolean hideCursor);

This seems like an unnecessary duplication of methods. Can you not just keep 
the existing `_enterFullscreen()` method, and return `JNI_TRUE`?

modules/javafx.graphics/src/main/native-glass/gtk/glass_general.cpp line 696:

> 694:     GdkPixbuf * ret = NULL;
> 695: 
> 696:      gdk_pixbuf_get_from_window (window, srcx, srcy, width, height);

The indentation is off here.

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

> 1628:     // directly to the base implementation.
> 1629:     if (is_fullscreen() || get_frame_type() != EXTENDED || 
> get_jwindow() == nullptr) {
> 1630:         WindowContext::process_mouse_button(event);

Isn't the `get_frame_type() != EXTENDED` condition unnecessary here?

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

> 1697:     // Call the base implementation for client area events.
> 1698:     if (!is_floating()
> 1699:             || get_frame_type() != EXTENDED

`get_frame_type() != EXTENDED` probably unnecessary.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2160067754
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2160069489
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2160073423
PR Review Comment: https://git.openjdk.org/jfx/pull/1789#discussion_r2160073825

Reply via email to