From 2e982a1b6704cc01dbe00ae5963e1f50c46ad767 Mon Sep 17 00:00:00 2001 From: Steve Cornett <21205494+stevecor@users.noreply.github.com> Date: Thu, 23 Jul 2026 16:58:42 -0700 Subject: [PATCH] Fix dark mode title bar for Windows 10 1909 and 1903 in wxMSW This change essentially reverts ffeeb612cd (Remove not needed code for dark mode support under Windows 1809, 2026-06-26). The value of DWMWA_USE_IMMERSIVE_DARK_MODE changed in Windows 10 v2004, but we support dark mode on v1903 and later and we still need to use the old attribute value in this version and v1909. Closes #26732. --- src/msw/darkmode.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/msw/darkmode.cpp b/src/msw/darkmode.cpp index 62b6a471cf..ab0ceb567f 100644 --- a/src/msw/darkmode.cpp +++ b/src/msw/darkmode.cpp @@ -135,8 +135,6 @@ wxDarkModeSettings::~wxDarkModeSettings() = default; static const char* TRACE_DARKMODE = "msw-darkmode"; #endif // wxUSE_LOG_TRACE -#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 - namespace { @@ -479,6 +477,10 @@ void ConfigureTLW(HWND hwnd) { BOOL useDarkMode = wxMSWImpl::ShouldUseDarkMode(); + // The value of DWMWA_USE_IMMERSIVE_DARK_MODE is 20 since Windows 10 v2004 + // ("20H1", build 19041). Before that it was 19. + auto DWMWA_USE_IMMERSIVE_DARK_MODE = wxCheckOsVersion(10, 0, 19041) ? 20 : 19; + HRESULT hr = wxDarkModeModule::GetDwmSetWindowAttribute() ( hwnd,