Skip to content

Commit c911c3a

Browse files
fix(controls): Fix theme and accent color reset after Windows session unlock (#1608)
* Fix theme and accent color reset after Windows session unlock - Add session switch event handling to restore theme and accent color after unlock - Store current theme and accent color before session lock - Ignore WM_WININICHANGE messages during unlock restore period (5 seconds) - Preserve stored theme when it differs from system theme - Optimize code by removing unnecessary operations and using switch expressions - Remove debug output statements * Revert "Fix theme and accent color reset after Windows session unlock" This reverts commit 9b61717. * Changes to the Conditions for Executing UpdateObservedWindow
1 parent 7219fa6 commit c911c3a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Wpf.Ui/Appearance/SystemThemeWatcher.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ public static void UnWatch(Window? window)
151151
/// </summary>
152152
private static IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
153153
{
154-
if (msg == (int)PInvoke.WM_WININICHANGE)
154+
if (msg == (int)PInvoke.WM_DWMCOLORIZATIONCOLORCHANGED ||
155+
msg == (int)PInvoke.WM_THEMECHANGED ||
156+
msg == (int)PInvoke.WM_SYSCOLORCHANGE)
155157
{
156158
UpdateObservedWindow(hWnd);
157159
}

0 commit comments

Comments
 (0)