On Mon, 26 Oct 2026 00:28:29 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.
>> 
>> It refactors the Glass GTK implementation with a primary focus on window 
>> sizing, positioning, and state management, addressing a number of 
>> long-standing issues.
>> 
>> Previously, three separate context classes existed, two of which were used 
>> for Java Web Start and Applets. These have been unified, as they are no 
>> longer required.
>> 
>> Additional tests have been introduced to improve coverage. Some tests 
>> produced different results depending on the StageStyle, so they have been 
>> converted to use `@ParameterizedTest` to exercise multiple styles.
>> 
>> Although the primary focus is XWayland, the changes have also been verified 
>> to work correctly on Xorg.
>> 
>> This replaces #1789. It removes the use of GdkWindow in favor of GtkWindow, 
>> reducing risk and simplifying the review process while preserving the same 
>> set of bug fixes. Additionally, #2025 requires a `GtkWindow` to be used when 
>> setting the parent of the file chooser dialog.
>> 
>> To show debug messages,  build with `-PCONF=DebugNative`  and run with 
>> `-Djdk.gtk.verbose=true`. Log categories can be passed with 
>> `-Dglass.gtk.logCategories=CATEGORY` 
>> 
>> `CATEGORY` can be one or more of:
>> - all
>> - size
>> - position
>> - focus
>> - state
>> - lifecycle
>> - input
>> - dialog
>> 
>> Multiple categories can be specified by separating them with commas (e.g. 
>> size,focus,input).
>> 
>> A manual test is provided:
>> `java @build/run.args tests/manual/stage/TestStage.java`
>> 
>> When a window property is set, it is reported immediately. However, once it 
>> reaches the native Glass layer, it may be adjusted or rejected, causing the 
>> property to be updated again. Introducing a delay helps ensure the final 
>> state has been applied before it is verified.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   - Ungrab focus when hiding the window, so IME does not try to use it after 
> closed

I went through the implementation part and still have to go through the tests. 
Overall it's looking good, however I have some intermittent trouble running the 
tests with this PR - occasionally I get a hang with tests using screen capture. 
I took a closer look at it and I think that this is not really a regression of 
this PR, but rather an existing unrelated problem of our screencast code that 
your tests happen to expose. Our CI also caught this, so I will keep digging 
into that; if that is indeed our screen capture problem, we will have to fix it 
before we integrate this.

Another trouble I see is that when all system tests execute, some tests tend to 
do something that causes the focus to be lost (ie. all the usual focus-needing 
suspects like StageFocusTest, TextAreaBehavior etc. fail in a complete run). 
Not sure if this is related to the above problem or is it a separate problem of 
this PR, but I will keep digging.

For now, a few comments on my end to native-side part.

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

> 63:         delete ctx;
> 64:     }
> 65:     // else: ctx will be deleted in EventsCounterHelper after completing

Would `shared_ptr<WindowContext>` be a better fit here? This way it can be 
owned by both sides and it will be removed once both sides clear it.

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

PR Review: https://git.openjdk.org/jfx/pull/2139#pullrequestreview-4568740133
PR Review Comment: https://git.openjdk.org/jfx/pull/2139#discussion_r4399337203

Reply via email to