From 5d96ebc2252d930dcd21ed3cbe6fe69d4acecc8e Mon Sep 17 00:00:00 2001 From: d-bingham Date: Tue, 4 Jun 2019 15:25:24 -0500 Subject: [PATCH] Fix acrylic brush flash/fade on new tab creation. (#1092) Fixes #1082 -- #853's fix of the acrylic background's flash/fade on any settings change managed to cause a flash/fade on new tab creation. This change removed both flash/fades. #853 split background brush initialization from background color changes; due to the brush being constructed with a default color and then the color being initialized later, new tabs were getting the flash/fade that accompanies a re-focused fluent-style acrylic background. This PR initializes the acrylic color at brush initialization to avoid the problem. --- src/cascadia/TerminalControl/TermControl.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 347cee2539..9490763d5d 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -202,8 +202,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // enabled and no background image is present. // - Avoids image flickering and acrylic brush redraw if settings are changed // but the appropriate brush is still in place. - // - Does not apply background color; _BackgroundColorChanged must be called - // to do so. + // - Does not apply background color outside of acrylic mode; + // _BackgroundColorChanged must be called to do so. // Arguments: // - // Return Value: @@ -223,6 +223,18 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation acrylic.BackgroundSource(Media::AcrylicBackgroundSource::HostBackdrop); } + // see GH#1082: Initialize background color so we don't get a + // fade/flash when _BackgroundColorChanged is called + uint32_t color = _settings.DefaultBackground(); + winrt::Windows::UI::Color bgColor{}; + bgColor.R = GetRValue(color); + bgColor.G = GetGValue(color); + bgColor.B = GetBValue(color); + bgColor.A = 255; + + acrylic.FallbackColor(bgColor); + acrylic.TintColor(bgColor); + // Apply brush settings acrylic.TintOpacity(_settings.TintOpacity());