RFR: 8362091: Window title bar should reflect scene color scheme [v3]
Christopher Schnick
crschnick at xpipe.io
Tue Dec 30 16:35:09 UTC 2025
We bumped the release version of our JavaFX dependency to the latest ea,
so it includes this feature now. I received an anonymous error report
(so no details or log) about this error occuring on a Windows 11 system:
java.lang.UnsatisfiedLinkError:
at com.sun.glass.ui.win.WinWindow._setDarkFrame(WinWindow.java)
at com.sun.glass.ui.win.WinWindow.setDarkFrame(WinWindow.java:287)
at
com.sun.javafx.tk.quantum.WindowStage.setDarkFrame(WindowStage.java:919)
at javafx.stage.Window$SceneModel.updateDarkFrame(Window.java:899)
at
com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:192)
at
com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
at
javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
at
com.sun.javafx.beans.property.NullCoalescingPropertyBase.fireValueChangedEvent(NullCoalescingPropertyBase.java:88)
at
com.sun.javafx.beans.property.NullCoalescingPropertyBase.lambda$new$0(NullCoalescingPropertyBase.java:44)
at
javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:86)
at
com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:386)
at
com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
at
javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:80)
at
com.sun.javafx.application.preferences.PreferenceProperties$ColorSchemeProperty.fireValueChangeIfNecessary(PreferenceProperties.java:327)
at
com.sun.javafx.application.preferences.PreferenceProperties.update(PreferenceProperties.java:187)
at
com.sun.javafx.application.preferences.PlatformPreferences.update(PlatformPreferences.java:308)
at
com.sun.javafx.application.PlatformImpl.updatePreferences(PlatformImpl.java:951)
at
com.sun.javafx.tk.quantum.QuantumToolkit$2.handlePreferencesChanged(QuantumToolkit.java:374)
at
com.sun.glass.ui.Application.notifyPreferencesChanged(Application.java:261)
at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
at
com.sun.glass.ui.win.WinApplication.lambda$runLoop$0(WinApplication.java:168)
at java.lang.Thread.run(Thread.java:1474)
Maybe someone is using it a weird distribution of Windows 11 that you
typically don't find with end users. I sadly don't have any system
details. But in general it would be good if such an Error is caught and
handled properly. Because right now it is not caught anywhere.
On 02/10/2025 10:43 PM, Marius Hanl wrote:
> On Tue, 30 Sep 2025 20:08:55 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>
>>> Currently, the color scheme of a system-decorated stage is as follows:
>>> * On Windows, the title bar is always light (even if the OS color scheme is dark).
>>> * On macOS and Linux, the title bar is light or dark depending on the OS color scheme.
>>>
>>> The expected behavior is that the title bar matches the color scheme of the `Scene`.
>>> If an application doesn't specify a color scheme, the title bar color should match the OS color scheme.
>>>
>>> This PR fixes the behavior for Windows and macOS, but not for Linux (there's no good way to do that).
>>> Depending on how you look at it, this is either a bug fix or an enhancement.
>> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
>>
>> - explicitly use wide string functions
>> - Merge branch 'master' into feature/dark-window-frame
>> - Merge branch 'master' into feature/dark-window-frame
>>
>> # Conflicts:
>> # modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m
>> - Window decorations adapt to color scheme
> Had no time to further check this unfortunately, but did a lot of testing today and found no issues on Windows 11!
> Tested also with an application where I implemented a dark/light mode switch with the new `@media` queries and `prefers-color-scheme`.
>
> https://github.com/user-attachments/assets/48fc2b82-1cbe-4067-a7a2-b21ce3052e7c
>
> As mentioned above, Godot has the same logic as we have in the Windows code, so the Windows part looked good to me.
>
> -------------
>
> PR Comment: https://git.openjdk.org/jfx/pull/1845#issuecomment-3362898888
More information about the openjfx-dev
mailing list