From 21cfbf170c0724b911c9bda4e664d5f03aa636e8 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Mon, 25 Aug 2025 12:46:47 -0500 Subject: [PATCH] Move to CppWinRT 2.0.250303.1 (#19268) Interesting changes in this update: - better support for `REFIID,IUnknown**` in `capture` - `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS` for all SxS DLL loading - `get_self` reading from classic COM interfaces (rather than WinRT ones) - better incremental builds by ignoring stale winmd files (see microsoft/cppwinrt#1404) - some ability to mix c++17 and c++20 static libraries - better codegen for `consume` methods This version of C++/WinRT is better about propagating `protected` fields from the metadata into the C++ projections. This required us to switch to the `I...Protected` interfaces for some things we are _technically_ not allowed access to. We also had some `overridable` (protected!) members of our own that needed undec- oration. --- dep/nuget/packages.config | 2 +- scratch/ScratchIslandApp/SampleApp/packages.config | 2 +- scratch/ScratchIslandApp/WindowExe/packages.config | 2 +- src/cascadia/TerminalApp/Tab.idl | 4 ++-- .../TerminalControl/InteractivityAutomationPeer.cpp | 2 +- src/cascadia/TerminalControl/TermControl.cpp | 5 +++-- .../TerminalSettingsModel/MediaResourceSupport.h | 4 ++-- src/cascadia/UIHelpers/TextMenuFlyout.cpp | 12 +++++++----- src/common.nugetversions.props | 2 +- src/common.nugetversions.targets | 6 +++--- 10 files changed, 22 insertions(+), 19 deletions(-) diff --git a/dep/nuget/packages.config b/dep/nuget/packages.config index f28aa77888..a7c94bbf31 100644 --- a/dep/nuget/packages.config +++ b/dep/nuget/packages.config @@ -4,7 +4,7 @@ - + diff --git a/scratch/ScratchIslandApp/SampleApp/packages.config b/scratch/ScratchIslandApp/SampleApp/packages.config index e970765c71..ac7697d8fc 100644 --- a/scratch/ScratchIslandApp/SampleApp/packages.config +++ b/scratch/ScratchIslandApp/SampleApp/packages.config @@ -1,6 +1,6 @@ - + diff --git a/scratch/ScratchIslandApp/WindowExe/packages.config b/scratch/ScratchIslandApp/WindowExe/packages.config index e970765c71..ac7697d8fc 100644 --- a/scratch/ScratchIslandApp/WindowExe/packages.config +++ b/scratch/ScratchIslandApp/WindowExe/packages.config @@ -1,6 +1,6 @@ - + diff --git a/src/cascadia/TerminalApp/Tab.idl b/src/cascadia/TerminalApp/Tab.idl index 0f214133a6..e585babafc 100644 --- a/src/cascadia/TerminalApp/Tab.idl +++ b/src/cascadia/TerminalApp/Tab.idl @@ -21,8 +21,8 @@ namespace TerminalApp UInt32 TabViewIndex; UInt32 TabViewNumTabs; - overridable void Focus(Windows.UI.Xaml.FocusState focusState); - overridable void Shutdown(); + void Focus(Windows.UI.Xaml.FocusState focusState); + void Shutdown(); void SetDispatch(ShortcutActionDispatch dispatch); } diff --git a/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp b/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp index 77780108c8..c20845cea8 100644 --- a/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp +++ b/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp @@ -190,7 +190,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation { return nullptr; } - const auto xutr = winrt::make_self(returnVal, parent.ProviderFromPeer(parent)); + const auto xutr = winrt::make_self(returnVal, parent.as().ProviderFromPeer(parent)); return xutr.as(); }; diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 01ebc90d86..b5f964e99e 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -3458,13 +3458,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation // Switch on the light and animate the intensity to fade out VisualBellLight::SetIsTarget(RootGrid(), true); + auto compositionLight{ BellLight().as().CompositionLight() }; if (_isBackgroundLight) { - BellLight().CompositionLight().StartAnimation(L"Intensity", _bellDarkAnimation); + compositionLight.StartAnimation(L"Intensity", _bellDarkAnimation); } else { - BellLight().CompositionLight().StartAnimation(L"Intensity", _bellLightAnimation); + compositionLight.StartAnimation(L"Intensity", _bellLightAnimation); } } } diff --git a/src/cascadia/TerminalSettingsModel/MediaResourceSupport.h b/src/cascadia/TerminalSettingsModel/MediaResourceSupport.h index 1cf063092c..4546801f7a 100644 --- a/src/cascadia/TerminalSettingsModel/MediaResourceSupport.h +++ b/src/cascadia/TerminalSettingsModel/MediaResourceSupport.h @@ -24,7 +24,7 @@ struct namespace winrt::Microsoft::Terminal::Settings::Model::implementation { - struct EmptyMediaResource : winrt::implements + struct EmptyMediaResource : winrt::implements { // Micro-optimization: having one empty resource that contains no actual paths saves us a few bytes per object winrt::hstring Path() { return {}; }; @@ -58,7 +58,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation * path--this is intended to aid its use in places where the risk of using an unresolved media path * is fine. */ - struct MediaResource : winrt::implements + struct MediaResource : winrt::implements { MediaResource() {} MediaResource(const winrt::hstring& p) : diff --git a/src/cascadia/UIHelpers/TextMenuFlyout.cpp b/src/cascadia/UIHelpers/TextMenuFlyout.cpp index 57dbc486f9..b5cb1aaf5e 100644 --- a/src/cascadia/UIHelpers/TextMenuFlyout.cpp +++ b/src/cascadia/UIHelpers/TextMenuFlyout.cpp @@ -43,7 +43,9 @@ namespace winrt::Microsoft::Terminal::UI::implementation // No common interface. if (const auto box = target.try_as()) { - target = box.GetTemplateChild(L"InputBox").as(); + // Accessing template children from outside the class is unspecified; GetTemplateChild is + // a protected member. It does work, though. + target = box.as().GetTemplateChild(L"InputBox").as(); } if (const auto control = target.try_as()) { @@ -98,7 +100,7 @@ namespace winrt::Microsoft::Terminal::UI::implementation if (const auto box = target.try_as()) { - target = box.GetTemplateChild(L"InputBox").as(); + target = box.as().GetTemplateChild(L"InputBox").as(); } if (const auto control = target.try_as()) { @@ -116,7 +118,7 @@ namespace winrt::Microsoft::Terminal::UI::implementation if (const auto box = target.try_as()) { - target = box.GetTemplateChild(L"InputBox").as(); + target = box.as().GetTemplateChild(L"InputBox").as(); } if (const auto control = target.try_as()) { @@ -142,7 +144,7 @@ namespace winrt::Microsoft::Terminal::UI::implementation if (const auto box = target.try_as()) { - target = box.GetTemplateChild(L"InputBox").as(); + target = box.as().GetTemplateChild(L"InputBox").as(); } if (const auto control = target.try_as()) { @@ -169,7 +171,7 @@ namespace winrt::Microsoft::Terminal::UI::implementation if (const auto box = target.try_as()) { - target = box.GetTemplateChild(L"InputBox").as(); + target = box.as().GetTemplateChild(L"InputBox").as(); } if (const auto control = target.try_as()) { diff --git a/src/common.nugetversions.props b/src/common.nugetversions.props index 6e53f2cde2..ab545dcb3e 100644 --- a/src/common.nugetversions.props +++ b/src/common.nugetversions.props @@ -4,7 +4,7 @@ - + diff --git a/src/common.nugetversions.targets b/src/common.nugetversions.targets index fc2ee146e7..186f933be3 100644 --- a/src/common.nugetversions.targets +++ b/src/common.nugetversions.targets @@ -41,7 +41,7 @@ - + @@ -78,8 +78,8 @@ - - + +