diff --git a/dep/nuget/packages.config b/dep/nuget/packages.config index fb1f261b593..d0c670dcd57 100644 --- a/dep/nuget/packages.config +++ b/dep/nuget/packages.config @@ -5,7 +5,7 @@ - + diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp index 9d2066a5dac..ddbbafdbe9b 100644 --- a/src/cascadia/WindowsTerminal/AppHost.cpp +++ b/src/cascadia/WindowsTerminal/AppHost.cpp @@ -1089,7 +1089,7 @@ void AppHost::_updateTheme() // It must be done before WM_NCPAINT so that the borders are rendered with // the correct theme. // For more information, see GH#6620. - LOG_IF_FAILED(TerminalTrySetDarkTheme(_window->GetHandle(), _isActuallyDarkTheme(theme.RequestedTheme()))); + _window->UseDarkTheme(_isActuallyDarkTheme(theme.RequestedTheme())); // Update the window frame. If `rainbowFrame:true` is enabled, then that // will be used. Otherwise we'll try to use the `FrameBrush` set in the diff --git a/src/cascadia/WindowsTerminal/IslandWindow.cpp b/src/cascadia/WindowsTerminal/IslandWindow.cpp index 5c0e7792966..88e15c9ede5 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/IslandWindow.cpp @@ -1873,6 +1873,12 @@ void IslandWindow::RemoveFromSystemMenu(const winrt::hstring& itemLabel) _systemMenuItems.erase(it->first); } +void IslandWindow::UseDarkTheme(const bool v) +{ + const BOOL attribute = v ? TRUE : FALSE; + std::ignore = DwmSetWindowAttribute(GetHandle(), DWMWA_USE_IMMERSIVE_DARK_MODE, &attribute, sizeof(attribute)); +} + void IslandWindow::UseMica(const bool newValue, const double /*titlebarOpacity*/) { // This block of code enables Mica for our window. By all accounts, this @@ -1907,7 +1913,7 @@ void IslandWindow::UseMica(const bool newValue, const double /*titlebarOpacity*/ // the darkness of our window. However, we're keeping this call to prevent // the window from appearing as a white rectangle for a frame before we load // the rest of the settings. - LOG_IF_FAILED(TerminalTrySetDarkTheme(_window.get(), true)); + UseDarkTheme(true); return TRUE; } diff --git a/src/cascadia/WindowsTerminal/IslandWindow.h b/src/cascadia/WindowsTerminal/IslandWindow.h index ca34bc125bf..db7411f7345 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.h +++ b/src/cascadia/WindowsTerminal/IslandWindow.h @@ -65,6 +65,7 @@ class IslandWindow : void AddToSystemMenu(const winrt::hstring& itemLabel, winrt::delegate callback); void RemoveFromSystemMenu(const winrt::hstring& itemLabel); + void UseDarkTheme(const bool v); virtual void UseMica(const bool newValue, const double titlebarOpacity); WINRT_CALLBACK(DragRegionClicked, winrt::delegate<>); diff --git a/src/common.nugetversions.targets b/src/common.nugetversions.targets index bc949206615..3113c124072 100644 --- a/src/common.nugetversions.targets +++ b/src/common.nugetversions.targets @@ -46,7 +46,7 @@ - + @@ -82,7 +82,7 @@ - +