Skip to content

Commit bddd619

Browse files
committed
thanks Dustin 🙏
1 parent aa52042 commit bddd619

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/cascadia/TerminalControl/TermControl.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
279279
_core = _interactivity.Core();
280280

281281
// If high contrast mode was changed, update the appearance appropriately.
282-
_accessibilitySettings.HighContrastChanged([this](const Windows::UI::ViewManagement::AccessibilitySettings& a11ySettings, auto&&) {
283-
_core.SetHighContrastInfo(a11ySettings.HighContrast());
284-
_core.ApplyAppearance(_focused);
282+
_core.SetHighContrastInfo(_accessibilitySettings.HighContrast());
283+
_revokers.HighContrastChanged = _accessibilitySettings.HighContrastChanged(winrt::auto_revoke, [weakThis{ get_weak() }](const Windows::UI::ViewManagement::AccessibilitySettings& a11ySettings, auto&&) {
284+
if (auto termControl = weakThis.get())
285+
{
286+
termControl->_core.SetHighContrastInfo(a11ySettings.HighContrast());
287+
termControl->_core.ApplyAppearance(termControl->_focused);
288+
}
285289
});
286290

287291
// This event is specifically triggered by the renderer thread, a BG thread. Use a weak ref here.

src/cascadia/TerminalControl/TermControl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
479479
// These are set up in _InitializeTerminal
480480
Control::ControlCore::RendererWarning_revoker RendererWarning;
481481
Control::ControlCore::SwapChainChanged_revoker SwapChainChanged;
482+
Windows::UI::ViewManagement::AccessibilitySettings::HighContrastChanged_revoker HighContrastChanged;
482483

483484
Control::ControlInteractivity::OpenHyperlink_revoker interactivityOpenHyperlink;
484485
Control::ControlInteractivity::ScrollPositionChanged_revoker interactivityScrollPositionChanged;

0 commit comments

Comments
 (0)