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.
This commit is contained in:
Steve Cornett
2026-07-24 13:56:29 +02:00
committed by Vadim Zeitlin
parent 8003fd68a4
commit 2e982a1b67
+4 -2
View File
@@ -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,