RFR: 8362091: Window title bar should reflect scene color scheme [v2]
Kevin Rushforth
kcr at openjdk.org
Tue Sep 30 19:50:17 UTC 2025
On Sun, 27 Jul 2025 18:46:46 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 two commits:
>
> - 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
The changes look reasonable to me. I left a few comments. I still need to test the enhancement.
Speaking of testing, this causes a failure in one of our closed white-box tests. It's trivial for me to fix it, but it will mean that down the road, when this is ready to go in, we will need to coordinate the timing of the integration with you.
modules/javafx.graphics/src/main/native-glass/win/GlassWindow.cpp line 1269:
> 1267: static const DWORD DWMWA_USE_IMMERSIVE_DARK_MODE = []() {
> 1268: DWORD ignored;
> 1269: DWORD infoSize = GetFileVersionInfoSizeEx(FILE_VER_GET_NEUTRAL, L"dwmapi.dll", &ignored);
Since you are explicitly passing a wide string constant, shouldn't you also explicitly use the `GetFileVersionInfoSizeExW` variant of the function? (and yes, I know we define `/UNICODE` but it still seems cleaner to be explicit in this case).
modules/javafx.graphics/src/main/native-glass/win/GlassWindow.cpp line 1275:
> 1273:
> 1274: std::vector<char> buffer(infoSize);
> 1275: if (!GetFileVersionInfoEx(FILE_VER_GET_NEUTRAL, L"dwmapi.dll", ignored,
Use `GetFileVersionInfoExW`?
modules/javafx.graphics/src/main/native-glass/win/GlassWindow.cpp line 1282:
> 1280: UINT size = 0;
> 1281: VS_FIXEDFILEINFO* fileInfo = nullptr;
> 1282: if (!VerQueryValue(buffer.data(), L"\\", reinterpret_cast<LPVOID*>(&fileInfo), &size)) {
`VerQueryValueW`?
-------------
PR Review: https://git.openjdk.org/jfx/pull/1845#pullrequestreview-3286069445
PR Review Comment: https://git.openjdk.org/jfx/pull/1845#discussion_r2392367366
PR Review Comment: https://git.openjdk.org/jfx/pull/1845#discussion_r2392369375
PR Review Comment: https://git.openjdk.org/jfx/pull/1845#discussion_r2392389423
More information about the openjfx-dev
mailing list