On Sat, 14 Nov 2026 17:39:14 GMT, Michael Strauß <[email protected]> wrote:

> GTK's `PlatformSupport` class only listens to the `gtk-theme-name` signal to 
> detect theme changes. However, it seems that with KDE, color changes are 
> posted with a delay after the theme change. Since we only collect platform 
> preferences when the theme name was changed, we can miss delayed color 
> changes.
> 
> The fix is to also listen to a changed style context. The style context's 
> `changed` signal can fire multiple times, so we don't collect the new 
> preferences right away, but schedule them to be collected in an idle callback.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

modules/javafx.graphics/src/main/native-glass/gtk/PlatformSupport.cpp line 92:

> 90:     : env(env),
> 91:       application(env->NewGlobalRef(application)),
> 92:       styleContext(gtk_style_context_new()),

If I understand the documentation correctly, we might be able to use that style 
context also in `collectPreferences`? This would allow to replace the 2 
deprecated methods `gtk_style_new` and `gtk_style_lookup_color`.

The GTK docs suggest in 
https://docs.gtk.org/gtk3/method.Style.lookup_color.html to use 
`gtk_style_context_lookup_color` (with a `GtkStyleContext`).

Might be better as follow up, but interested if I this might make sense.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2372#discussion_r4587206895

Reply via email to