From 04691f4b3a5f42ba1afb09116e7ea6375ab352ba Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 31 Oct 2024 14:58:24 -0700 Subject: [PATCH] simplify; adapt; overcome --- src/cascadia/TerminalApp/AppLogic.cpp | 5 ---- src/cascadia/TerminalApp/AppLogic.h | 1 - src/cascadia/TerminalApp/AppLogic.idl | 1 - .../TerminalApp/TerminalPaneContent.cpp | 8 +++--- src/cascadia/TerminalControl/ControlCore.cpp | 6 ++++- src/cascadia/TerminalControl/ControlCore.h | 1 + src/cascadia/TerminalControl/ControlCore.idl | 1 + .../TerminalControl/ControlSettings.h | 2 -- .../TerminalControl/IControlSettings.idl | 2 -- src/cascadia/TerminalControl/TermControl.cpp | 8 ++++++ src/cascadia/TerminalControl/TermControl.h | 2 ++ src/cascadia/TerminalCore/ICoreAppearance.idl | 3 +-- src/cascadia/TerminalCore/Terminal.cpp | 4 +-- .../Resources/en-US/Resources.resw | 10 +++----- .../CascadiaSettings.cpp | 12 --------- .../TerminalSettingsModel/CascadiaSettings.h | 3 --- .../CascadiaSettings.idl | 1 - .../TerminalSettingsModel/TerminalSettings.h | 2 -- .../TerminalSettingsSerializationHelpers.h | 5 ++-- src/cascadia/WindowsTerminal/AppHost.cpp | 4 +-- src/cascadia/WindowsTerminal/AppHost.h | 4 +-- src/cascadia/WindowsTerminal/IslandWindow.cpp | 25 +------------------ src/cascadia/WindowsTerminal/IslandWindow.h | 3 +-- .../WindowsTerminal/WindowEmperor.cpp | 3 +-- src/cascadia/WindowsTerminal/WindowEmperor.h | 2 +- src/cascadia/WindowsTerminal/WindowThread.cpp | 4 +-- src/cascadia/WindowsTerminal/WindowThread.h | 2 +- src/cascadia/inc/ControlProperties.h | 2 +- 28 files changed, 39 insertions(+), 87 deletions(-) diff --git a/src/cascadia/TerminalApp/AppLogic.cpp b/src/cascadia/TerminalApp/AppLogic.cpp index 1badeddd22f..812a1cf1b7d 100644 --- a/src/cascadia/TerminalApp/AppLogic.cpp +++ b/src/cascadia/TerminalApp/AppLogic.cpp @@ -663,11 +663,6 @@ namespace winrt::TerminalApp::implementation globals.MinimizeToNotificationArea(); } - void AppLogic::SetHighContrast(bool highContrast) - { - _settings.HighContrastMode(highContrast); - } - bool AppLogic::AllowHeadless() { if (!_loadedInitialSettings) diff --git a/src/cascadia/TerminalApp/AppLogic.h b/src/cascadia/TerminalApp/AppLogic.h index 95bbbe71fe0..42f89942ad8 100644 --- a/src/cascadia/TerminalApp/AppLogic.h +++ b/src/cascadia/TerminalApp/AppLogic.h @@ -65,7 +65,6 @@ namespace winrt::TerminalApp::implementation bool IsolatedMode(); bool AllowHeadless(); bool RequestsTrayIcon(); - void SetHighContrast(bool highContrast); TerminalApp::TerminalWindow CreateNewWindow(); diff --git a/src/cascadia/TerminalApp/AppLogic.idl b/src/cascadia/TerminalApp/AppLogic.idl index a60d6e7b4e5..362c7405644 100644 --- a/src/cascadia/TerminalApp/AppLogic.idl +++ b/src/cascadia/TerminalApp/AppLogic.idl @@ -45,7 +45,6 @@ namespace TerminalApp Boolean IsolatedMode { get; }; Boolean AllowHeadless { get; }; Boolean RequestsTrayIcon { get; }; - void SetHighContrast(Boolean highContrast); FindTargetWindowResult FindTargetWindow(String[] args); diff --git a/src/cascadia/TerminalApp/TerminalPaneContent.cpp b/src/cascadia/TerminalApp/TerminalPaneContent.cpp index bfba9739776..1ab5cd013c8 100644 --- a/src/cascadia/TerminalApp/TerminalPaneContent.cpp +++ b/src/cascadia/TerminalApp/TerminalPaneContent.cpp @@ -339,13 +339,11 @@ namespace winrt::TerminalApp::implementation RestartTerminalRequested.raise(*this, nullptr); } - void TerminalPaneContent::UpdateSettings(const CascadiaSettings& settings) + void TerminalPaneContent::UpdateSettings(const CascadiaSettings& /*settings*/) { - if (const auto& cachedSettings{ _cache.TryLookup(_profile) }) + if (const auto& settings{ _cache.TryLookup(_profile) }) { - auto cachedDefaultSettings = cachedSettings.DefaultSettings(); - cachedDefaultSettings.HighContrastMode(settings.HighContrastMode()); - _control.UpdateControlSettings(cachedDefaultSettings, cachedSettings.UnfocusedSettings()); + _control.UpdateControlSettings(settings.DefaultSettings(), settings.UnfocusedSettings()); } } diff --git a/src/cascadia/TerminalControl/ControlCore.cpp b/src/cascadia/TerminalControl/ControlCore.cpp index d1128592ad7..354afd8cb42 100644 --- a/src/cascadia/TerminalControl/ControlCore.cpp +++ b/src/cascadia/TerminalControl/ControlCore.cpp @@ -864,7 +864,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation _cellHeight = CSSLengthPercentage::FromString(_settings->CellHeight().c_str()); _runtimeOpacity = std::nullopt; _runtimeFocusedOpacity = std::nullopt; - _terminal->SetHighContrastInfo(settings.HighContrastMode()); // Manually turn off acrylic if they turn off transparency. _runtimeUseAcrylic = _settings->Opacity() < 1.0 && _settings->UseAcrylic(); @@ -942,6 +941,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation } } + void ControlCore::SetHighContrastInfo(const bool enabled) + { + _terminal->SetHighContrastInfo(enabled); + } + Control::IControlSettings ControlCore::Settings() { return *_settings; diff --git a/src/cascadia/TerminalControl/ControlCore.h b/src/cascadia/TerminalControl/ControlCore.h index 1719f34c880..4bc07c94db1 100644 --- a/src/cascadia/TerminalControl/ControlCore.h +++ b/src/cascadia/TerminalControl/ControlCore.h @@ -94,6 +94,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation void UpdateSettings(const Control::IControlSettings& settings, const IControlAppearance& newAppearance); void ApplyAppearance(const bool focused); + void SetHighContrastInfo(const bool enabled); Control::IControlSettings Settings(); Control::IControlAppearance FocusedAppearance() const; Control::IControlAppearance UnfocusedAppearance() const; diff --git a/src/cascadia/TerminalControl/ControlCore.idl b/src/cascadia/TerminalControl/ControlCore.idl index ee1a4787e22..5ffa1260a1f 100644 --- a/src/cascadia/TerminalControl/ControlCore.idl +++ b/src/cascadia/TerminalControl/ControlCore.idl @@ -102,6 +102,7 @@ namespace Microsoft.Terminal.Control IControlAppearance FocusedAppearance { get; }; IControlAppearance UnfocusedAppearance { get; }; Boolean HasUnfocusedAppearance(); + void SetHighContrastInfo(Boolean enabled); UInt64 SwapChainHandle { get; }; diff --git a/src/cascadia/TerminalControl/ControlSettings.h b/src/cascadia/TerminalControl/ControlSettings.h index 65cd34131c7..75d12b97070 100644 --- a/src/cascadia/TerminalControl/ControlSettings.h +++ b/src/cascadia/TerminalControl/ControlSettings.h @@ -26,8 +26,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation CONTROL_SETTINGS(SETTINGS_GEN) #undef SETTINGS_GEN - WINRT_PROPERTY(bool, HighContrastMode, false); - private: winrt::com_ptr _unfocusedAppearance{ nullptr }; winrt::com_ptr _focusedAppearance{ nullptr }; diff --git a/src/cascadia/TerminalControl/IControlSettings.idl b/src/cascadia/TerminalControl/IControlSettings.idl index a90543eabc5..96b5b6b95f8 100644 --- a/src/cascadia/TerminalControl/IControlSettings.idl +++ b/src/cascadia/TerminalControl/IControlSettings.idl @@ -70,7 +70,5 @@ namespace Microsoft.Terminal.Control Boolean RepositionCursorWithMouse { get; }; // NOTE! When adding something here, make sure to update ControlProperties.h too! - // Non-serialized settings - Boolean HighContrastMode; }; } diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index f76c8c59403..327d8c922e4 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -58,6 +58,8 @@ static Microsoft::Console::TSF::Handle& GetTSFHandle() namespace winrt::Microsoft::Terminal::Control::implementation { + Windows::UI::ViewManagement::AccessibilitySettings TermControl::_accessibilitySettings{}; + TsfDataProvider::TsfDataProvider(TermControl* termControl) noexcept : _termControl{ termControl } { @@ -187,6 +189,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation _core = _interactivity.Core(); + // If high contrast mode was changed, update the appearance appropriately. + _accessibilitySettings.HighContrastChanged([this](const Windows::UI::ViewManagement::AccessibilitySettings& a11ySettings, auto&&) { + _core.SetHighContrastInfo(a11ySettings.HighContrast()); + _core.ApplyAppearance(_focused); + }); + // This event is specifically triggered by the renderer thread, a BG thread. Use a weak ref here. _revokers.RendererEnteredErrorState = _core.RendererEnteredErrorState(winrt::auto_revoke, { get_weak(), &TermControl::_RendererEnteredErrorState }); diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index ab7ae8556d9..2212e9980e4 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -237,6 +237,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation friend struct TermControlT; // friend our parent so it can bind private event handlers friend struct TsfDataProvider; + static Windows::UI::ViewManagement::AccessibilitySettings _accessibilitySettings; + // NOTE: _uiaEngine must be ordered before _core. // // ControlCore::AttachUiaEngine receives a IRenderEngine as a raw pointer, which we own. diff --git a/src/cascadia/TerminalCore/ICoreAppearance.idl b/src/cascadia/TerminalCore/ICoreAppearance.idl index 66f07bd4537..d86fdd42621 100644 --- a/src/cascadia/TerminalCore/ICoreAppearance.idl +++ b/src/cascadia/TerminalCore/ICoreAppearance.idl @@ -24,8 +24,7 @@ namespace Microsoft.Terminal.Core Never, Indexed, Always, - AutomaticIndexed, - AutomaticAlways + Automatic }; // TerminalCore declares its own Color struct to avoid depending diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index dcbee2f34f6..fd0460a7248 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -147,10 +147,8 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance) const auto initialAIC = appearance.AdjustIndistinguishableColors(); switch (initialAIC) { - case AdjustTextMode::AutomaticIndexed: + case AdjustTextMode::Automatic: return _highContrastMode ? AdjustTextMode::Indexed : AdjustTextMode::Never; - case AdjustTextMode::AutomaticAlways: - return _highContrastMode ? AdjustTextMode::Always : AdjustTextMode::Never; default: return initialAIC; } diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index d7249733998..4778b68ae86 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -942,13 +942,9 @@ Always An option to choose from for the "adjust indistinguishable colors" setting. When selected, we will adjust the text colors for visibility. - - When High Contrast is enabled, only for colors in the color scheme + + Automatic An option to choose from for the "adjust indistinguishable colors" setting. When selected, we will adjust the text colors for visibility only when the colors are part of this profile's color scheme's color table if and only if high contrast mode is enabled. - - - When High Contrast Mode is enabled, all colors - An option to choose from for the "adjust indistinguishable colors" setting. When selected, we will adjust the text colors for visibility if and only if high contrast mode is enabled. Bar ( ┃ ) @@ -1969,4 +1965,4 @@ Display a shield in the title bar when Windows Terminal is running as Administrator Header for a control to toggle displaying a shield in the title bar of the app. "Admin" refers to elevated sessions like "run as Admin" - \ No newline at end of file + diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp index 52315b264ec..6b412d28b68 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp @@ -23,8 +23,6 @@ using namespace winrt::Microsoft::Terminal::Control; using namespace winrt::Windows::Foundation::Collections; using namespace Microsoft::Console; -bool CascadiaSettings::_highContrastMode{ false }; - // Creating a child of a profile requires us to copy certain // required attributes. This method handles those attributes. // @@ -55,16 +53,6 @@ std::string_view Model::implementation::LoadStringResource(int resourceID) return { reinterpret_cast(ptr), sz }; } -bool CascadiaSettings::HighContrastMode() -{ - return _highContrastMode; -} - -void CascadiaSettings::HighContrastMode(bool value) -{ - _highContrastMode = value; -} - winrt::hstring CascadiaSettings::Hash() const noexcept { return _hash; diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.h b/src/cascadia/TerminalSettingsModel/CascadiaSettings.h index 8092bf000ea..e91c43885e9 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.h +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.h @@ -114,8 +114,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation static winrt::hstring ApplicationDisplayName(); static winrt::hstring ApplicationVersion(); static bool IsPortableMode(); - static bool HighContrastMode(); - static void HighContrastMode(bool value); CascadiaSettings() noexcept = default; CascadiaSettings(const winrt::hstring& userJSON, const winrt::hstring& inboxJSON); @@ -160,7 +158,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation static const std::filesystem::path& _settingsPath(); static const std::filesystem::path& _releaseSettingsPath(); static winrt::hstring _calculateHash(std::string_view settings, const FILETIME& lastWriteTime); - static bool _highContrastMode; winrt::com_ptr _createNewProfile(const std::wstring_view& name) const; Model::Profile _getProfileForCommandLine(const winrt::hstring& commandLine) const; diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.idl b/src/cascadia/TerminalSettingsModel/CascadiaSettings.idl index 78b2e89432b..2fa41941d6e 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.idl +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.idl @@ -16,7 +16,6 @@ namespace Microsoft.Terminal.Settings.Model static String SettingsPath { get; }; static String DefaultSettingsPath { get; }; static Boolean IsPortableMode { get; }; - static Boolean HighContrastMode; static String ApplicationDisplayName { get; }; static String ApplicationVersion { get; }; diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.h b/src/cascadia/TerminalSettingsModel/TerminalSettings.h index 8371b1bda6a..e47e8da81d1 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.h @@ -178,8 +178,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation INHERITABLE_SETTING(Model::TerminalSettings, bool, ReloadEnvironmentVariables, true); - WINRT_PROPERTY(bool, HighContrastMode, false); - private: std::optional> _ColorTable; std::span _getColorTableImpl(); diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index 1736d42b653..a2659de7135 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -35,12 +35,11 @@ JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Core::CursorStyle) // - Helper for converting a user-specified adjustTextMode value to its corresponding enum JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Core::AdjustTextMode) { - JSON_MAPPINGS(5) = { + JSON_MAPPINGS(4) = { pair_type{ "never", ValueType::Never }, pair_type{ "indexed", ValueType::Indexed }, pair_type{ "always", ValueType::Always }, - pair_type{ "automaticIndexed", ValueType::AutomaticIndexed }, - pair_type{ "automaticAlways", ValueType::AutomaticAlways }, + pair_type{ "automatic", ValueType::Automatic }, }; // Override mapping parser to add boolean parsing diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp index 088339f4e6a..86d70a4d81d 100644 --- a/src/cascadia/WindowsTerminal/AppHost.cpp +++ b/src/cascadia/WindowsTerminal/AppHost.cpp @@ -1574,7 +1574,7 @@ void AppHost::_handleSendContent(const winrt::Windows::Foundation::IInspectable& // Bubble the update settings request up to the emperor. We're being called on // the Window thread, but the Emperor needs to update the settings on the _main_ // thread. -void AppHost::_requestUpdateSettings(bool highContrastEnabled) +void AppHost::_requestUpdateSettings() { - UpdateSettingsRequested.raise(highContrastEnabled); + UpdateSettingsRequested.raise(); } diff --git a/src/cascadia/WindowsTerminal/AppHost.h b/src/cascadia/WindowsTerminal/AppHost.h index 1a8bbf40aa7..7e2d8778a2b 100644 --- a/src/cascadia/WindowsTerminal/AppHost.h +++ b/src/cascadia/WindowsTerminal/AppHost.h @@ -32,7 +32,7 @@ class AppHost : public std::enable_shared_from_this static void s_DisplayMessageBox(const winrt::TerminalApp::ParseCommandlineResult& message); - til::event> UpdateSettingsRequested; + til::event> UpdateSettingsRequested; private: std::unique_ptr _window; @@ -151,7 +151,7 @@ class AppHost : public std::enable_shared_from_this void _handleAttach(const winrt::Windows::Foundation::IInspectable& sender, winrt::Microsoft::Terminal::Remoting::AttachRequest args); - void _requestUpdateSettings(bool highContrastEnabled); + void _requestUpdateSettings(); // Page -> us -> monarch void _handleReceiveContent(const winrt::Windows::Foundation::IInspectable& sender, diff --git a/src/cascadia/WindowsTerminal/IslandWindow.cpp b/src/cascadia/WindowsTerminal/IslandWindow.cpp index 656b0fe22a4..e0b13ded48f 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/IslandWindow.cpp @@ -758,8 +758,6 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize // themes, color schemes that might depend on the OS theme if (param == L"ImmersiveColorSet") { - bool updateSettings = false; - // GH#15732: Don't update the settings, unless the theme // _actually_ changed. ImmersiveColorSet gets sent more often // than just on a theme change. It notably gets sent when the PC @@ -768,28 +766,7 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize if (isCurrentlyDark != _currentSystemThemeIsDark) { _currentSystemThemeIsDark = isCurrentlyDark; - updateSettings = true; - } - - bool isCurrentlyHighContrast = []() { - HIGHCONTRAST hc = { 0 }; - hc.cbSize = sizeof(HIGHCONTRAST); - if (SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(hc), &hc, 0)) - { - return (bool)(hc.dwFlags & HCF_HIGHCONTRASTON); - } - return false; - }(); - - if (isCurrentlyHighContrast != _currentHighContrastModeState) - { - _currentHighContrastModeState = isCurrentlyHighContrast; - updateSettings = true; - } - - if (updateSettings) - { - UpdateSettingsRequested.raise(_currentHighContrastModeState); + UpdateSettingsRequested.raise(); } } } diff --git a/src/cascadia/WindowsTerminal/IslandWindow.h b/src/cascadia/WindowsTerminal/IslandWindow.h index dfa50d2d477..7a67211ad6a 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.h +++ b/src/cascadia/WindowsTerminal/IslandWindow.h @@ -87,7 +87,7 @@ class IslandWindow : til::event> WindowMoved; til::event> WindowVisibilityChanged; - til::event> UpdateSettingsRequested; + til::event> UpdateSettingsRequested; protected: void ForceResize() @@ -118,7 +118,6 @@ class IslandWindow : RECT _rcWorkBeforeFullscreen{}; UINT _dpiBeforeFullscreen{ 96 }; bool _currentSystemThemeIsDark{ true }; - bool _currentHighContrastModeState{ false }; void _coldInitialize(); void _warmInitialize(); diff --git a/src/cascadia/WindowsTerminal/WindowEmperor.cpp b/src/cascadia/WindowsTerminal/WindowEmperor.cpp index eaf3330513f..ff22b8e53e8 100644 --- a/src/cascadia/WindowsTerminal/WindowEmperor.cpp +++ b/src/cascadia/WindowsTerminal/WindowEmperor.cpp @@ -850,10 +850,9 @@ safe_void_coroutine WindowEmperor::_windowIsQuakeWindowChanged(winrt::Windows::F co_await wil::resume_foreground(this->_dispatcher); _checkWindowsForNotificationIcon(); } -safe_void_coroutine WindowEmperor::_windowRequestUpdateSettings(bool highContrastEnabled) +safe_void_coroutine WindowEmperor::_windowRequestUpdateSettings() { // We MUST be on the main thread to update the settings. We will crash when trying to enumerate fragment extensions otherwise. co_await wil::resume_foreground(this->_dispatcher); - _app.Logic().SetHighContrast(highContrastEnabled); _app.Logic().ReloadSettings(); } diff --git a/src/cascadia/WindowsTerminal/WindowEmperor.h b/src/cascadia/WindowsTerminal/WindowEmperor.h index 12839669b53..6a7f0a0fda6 100644 --- a/src/cascadia/WindowsTerminal/WindowEmperor.h +++ b/src/cascadia/WindowsTerminal/WindowEmperor.h @@ -62,7 +62,7 @@ class WindowEmperor : public std::enable_shared_from_this void _numberOfWindowsChanged(const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::Foundation::IInspectable&); safe_void_coroutine _windowIsQuakeWindowChanged(winrt::Windows::Foundation::IInspectable sender, winrt::Windows::Foundation::IInspectable args); - safe_void_coroutine _windowRequestUpdateSettings(bool highContrastEnabled); + safe_void_coroutine _windowRequestUpdateSettings(); void _createMessageWindow(); diff --git a/src/cascadia/WindowsTerminal/WindowThread.cpp b/src/cascadia/WindowsTerminal/WindowThread.cpp index 8313f59d118..8fef9053434 100644 --- a/src/cascadia/WindowsTerminal/WindowThread.cpp +++ b/src/cascadia/WindowsTerminal/WindowThread.cpp @@ -33,7 +33,7 @@ void WindowThread::CreateHost() _manager, _peasant); - _UpdateSettingsRequestedToken = _host->UpdateSettingsRequested([this](bool highContrastEnabled) { UpdateSettingsRequested.raise(highContrastEnabled); }); + _UpdateSettingsRequestedToken = _host->UpdateSettingsRequested([this]() { UpdateSettingsRequested.raise(); }); winrt::init_apartment(winrt::apartment_type::single_threaded); @@ -113,7 +113,7 @@ bool WindowThread::KeepWarm() // state transitions. In this case, the window is actually being woken up. if (msg.message == AppHost::WM_REFRIGERATE) { - _UpdateSettingsRequestedToken = _host->UpdateSettingsRequested([this](bool highContrastEnabled) { UpdateSettingsRequested.raise(highContrastEnabled); }); + _UpdateSettingsRequestedToken = _host->UpdateSettingsRequested([this]() { UpdateSettingsRequested.raise(); }); // Re-initialize the host here, on the window thread _host->Initialize(); return true; diff --git a/src/cascadia/WindowsTerminal/WindowThread.h b/src/cascadia/WindowsTerminal/WindowThread.h index 47913a8979d..0104740d859 100644 --- a/src/cascadia/WindowsTerminal/WindowThread.h +++ b/src/cascadia/WindowsTerminal/WindowThread.h @@ -25,7 +25,7 @@ class WindowThread : public std::enable_shared_from_this uint64_t PeasantID(); - til::event> UpdateSettingsRequested; + til::event> UpdateSettingsRequested; private: winrt::Microsoft::Terminal::Remoting::Peasant _peasant{ nullptr }; diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index a9a67fc6ef4..de9765ffaa8 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -14,7 +14,7 @@ X(til::color, SelectionBackground, DEFAULT_FOREGROUND) \ X(bool, IntenseIsBold) \ X(bool, IntenseIsBright, true) \ - X(winrt::Microsoft::Terminal::Core::AdjustTextMode, AdjustIndistinguishableColors, winrt::Microsoft::Terminal::Core::AdjustTextMode::AutomaticIndexed) + X(winrt::Microsoft::Terminal::Core::AdjustTextMode, AdjustIndistinguishableColors, winrt::Microsoft::Terminal::Core::AdjustTextMode::Automatic) // --------------------------- Control Appearance --------------------------- // All of these settings are defined in IControlAppearance.