Repository navigation
fix: report the system accent colour consistently on Windows - #54353
Merged
Merged
Conversation
systemPreferences read HKCU\...\DWM\AccentColor directly for getAccentColor() but emitted 'accent-color-changed' with the DWM *colorization* colour from WM_DWMCOLORIZATIONCOLORCHANGED, formatted by a separate lowercase helper, so the event's newColor did not match getAccentColor() and the change de-duplication never matched on the first event. NativeWindowViews kept two more registry readers for the same key. Use ui::AccentColorObserver for all of it: it watches the DWM key, prefers the UISettings value Windows actually applies, and exposes ShouldUseAccentColorForWindowFrame(). This removes systemPreferences' hidden WS_POPUP broadcast window.
…ations NativeWindowViews read the observer's cached colour from the WM_DWMCOLORIZATIONCOLORCHANGED / WM_SETTINGCHANGE handlers, which can run before the observer's registry watch has refreshed that cache, and nothing reapplied the colour afterwards. Subscribe to the observer instead and drop the message handlers. Also emit systemPreferences' accent-color-changed from a posted task rather than from inside the observer's notification.
MarshallOfSound
force-pushed
the
fix/win-accent-color-observer
branch
from
September 25, 2026 10:30
8691bba to
c16933d
Compare
MarshallOfSound
enabled auto-merge (squash)
September 25, 2026 16:39
VerteDinde
approved these changes
Sep 25, 2026
|
Release Notes Persisted
|
Contributor
|
I was unable to backport this PR to "44-x-y" cleanly; |
Contributor
|
I have automatically backported this PR to "45-x-y", please check out #54405 |
Contributor
|
@MarshallOfSound has manually backported this PR to "44-x-y", please check out #54409 |
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…#54409) fix: report the system accent colour consistently on Windows (#54353) * fix: report the system accent colour consistently on Windows systemPreferences read HKCU\...\DWM\AccentColor directly for getAccentColor() but emitted 'accent-color-changed' with the DWM *colorization* colour from WM_DWMCOLORIZATIONCOLORCHANGED, formatted by a separate lowercase helper, so the event's newColor did not match getAccentColor() and the change de-duplication never matched on the first event. NativeWindowViews kept two more registry readers for the same key. Use ui::AccentColorObserver for all of it: it watches the DWM key, prefers the UISettings value Windows actually applies, and exposes ShouldUseAccentColorForWindowFrame(). This removes systemPreferences' hidden WS_POPUP broadcast window. * fix: refresh the frame accent colour from AccentColorObserver notifications NativeWindowViews read the observer's cached colour from the WM_DWMCOLORIZATIONCOLORCHANGED / WM_SETTINGCHANGE handlers, which can run before the observer's registry watch has refreshed that cache, and nothing reapplied the colour afterwards. Subscribe to the observer instead and drop the message handlers. Also emit systemPreferences' accent-color-changed from a posted task rather than from inside the observer's notification. (cherry picked from commit 8453f62)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
On Windows
systemPreferences.getAccentColor()readHKCU\...\DWM\AccentColor, butaccent-color-changedemitted the DWM colorization colour fromWM_DWMCOLORIZATIONCOLORCHANGEDthrough a separate lowercase formatter, so the event'snewColordid not matchgetAccentColor()and the change de-duplication never matched on the first event.NativeWindowViewshad two more readers of the same registry key.ui::AccentColorObserverforgetAccentColor(), theaccent-color-changedevent and the window frame accent colour; it watches the DWM key and prefers the UISettings value Windows actually applies.NativeWindowViewsreapplies the frame colour from the observer's notification instead of fromWM_DWMCOLORIZATIONCOLORCHANGED/WM_SETTINGCHANGE, which can arrive before the observer has re-read the registry;accent-color-changedis emitted from a posted task (as on Linux) rather than inside the observer's notification.WS_POPUPbroadcast window and the registry helpers incolor_util/native_window_views_win.Checklist
Release Notes
Notes: Fixed
accent-color-changedon Windows reporting a colour that differed fromsystemPreferences.getAccentColor().