diff --git a/build/rules/GenerateSxsManifestsFromWinmds.targets b/build/rules/GenerateSxsManifestsFromWinmds.targets
index 6d0888b88df..7911429a771 100644
--- a/build/rules/GenerateSxsManifestsFromWinmds.targets
+++ b/build/rules/GenerateSxsManifestsFromWinmds.targets
@@ -10,7 +10,7 @@
- <_ConsoleWinmdManifest Include="@(ReferencePath->'$(IntDir)\%(FileName).manifest')" Condition="'%(ReferencePath.IsSystemReference)' != 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ResolveAssemblyReference'">
+ <_ConsoleWinmdManifest Include="@(ReferencePath->'$(IntDir)\%(FileName).manifest')" Condition="'%(ReferencePath.IsSystemReference)' != 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ResolveAssemblyReference' and '%(ReferencePath.Implementation)' != ''">
%(ReferencePath.FullPath)
%(ReferencePath.Implementation)
diff --git a/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj b/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj
index 1a9b801fdcb..7ce1c43336a 100644
--- a/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj
+++ b/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj
@@ -339,4 +339,13 @@
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
diff --git a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj
index c24da27a8b7..df85df4f5f2 100644
--- a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj
+++ b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj
@@ -90,11 +90,11 @@
x86
$(Platform)
- <_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\runtimes\win10-$(Native-Platform)\native\"
+ <_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.2.190917002\runtimes\win10-$(Native-Platform)\native\"
-
+
diff --git a/src/cascadia/TerminalApp/App.h b/src/cascadia/TerminalApp/App.h
index f977fb7c3f9..faa67871e7b 100644
--- a/src/cascadia/TerminalApp/App.h
+++ b/src/cascadia/TerminalApp/App.h
@@ -76,21 +76,11 @@ namespace winrt::TerminalApp::implementation
void _OnLoaded(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
- void _LoadSettings();
void _RegisterSettingsChange();
fire_and_forget _DispatchReloadSettings();
void _ReloadSettings();
void _ApplyTheme(const Windows::UI::Xaml::ElementTheme& newTheme);
-
- static Windows::UI::Xaml::Controls::IconElement _GetIconFromProfile(const ::TerminalApp::Profile& profile);
-
- winrt::Microsoft::Terminal::TerminalControl::TermControl _GetFocusedControl();
-
- void _CopyToClipboardHandler(const IInspectable& sender, const winrt::Microsoft::Terminal::TerminalControl::CopyToClipboardEventArgs& copiedData);
- void _PasteFromClipboardHandler(const IInspectable& sender, const Microsoft::Terminal::TerminalControl::PasteFromClipboardEventArgs& eventArgs);
-
- static void _SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord);
};
}
diff --git a/src/cascadia/TerminalApp/App.xaml b/src/cascadia/TerminalApp/App.xaml
index 7b5ce85ed39..da983a33ded 100644
--- a/src/cascadia/TerminalApp/App.xaml
+++ b/src/cascadia/TerminalApp/App.xaml
@@ -49,13 +49,24 @@ the MIT License. See LICENSE in the project root for license information. -->
is unfortunately static. -->
+
+ 0,0,0,0
+
+
+
+
+
diff --git a/src/cascadia/TerminalApp/MinMaxCloseControl.xaml b/src/cascadia/TerminalApp/MinMaxCloseControl.xaml
index 454210c1bd4..9e6dfd758bf 100644
--- a/src/cascadia/TerminalApp/MinMaxCloseControl.xaml
+++ b/src/cascadia/TerminalApp/MinMaxCloseControl.xaml
@@ -8,7 +8,7 @@ the MIT License. See LICENSE in the project root for license information. -->
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
- Background="{ThemeResource SystemChromeLowColor}"
+ Background="Transparent"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Orientation="Horizontal"
diff --git a/src/cascadia/TerminalApp/Tab.cpp b/src/cascadia/TerminalApp/Tab.cpp
index c4e40032695..f0e2efa88c2 100644
--- a/src/cascadia/TerminalApp/Tab.cpp
+++ b/src/cascadia/TerminalApp/Tab.cpp
@@ -10,7 +10,10 @@ using namespace winrt::Windows::UI::Core;
using namespace winrt::Microsoft::Terminal::Settings;
using namespace winrt::Microsoft::Terminal::TerminalControl;
-static const int TabViewFontSize = 12;
+namespace winrt
+{
+ namespace MUX = Microsoft::UI::Xaml;
+}
Tab::Tab(const GUID& profile, const TermControl& control)
{
@@ -25,8 +28,7 @@ Tab::Tab(const GUID& profile, const TermControl& control)
void Tab::_MakeTabViewItem()
{
- _tabViewItem = ::winrt::Microsoft::UI::Xaml::Controls::TabViewItem{};
- _tabViewItem.FontSize(TabViewFontSize);
+ _tabViewItem = ::winrt::MUX::Controls::TabViewItem{};
}
UIElement Tab::GetRootElement()
@@ -50,7 +52,7 @@ TermControl Tab::GetFocusedTerminalControl()
return _rootPane->GetFocusedTerminalControl();
}
-winrt::Microsoft::UI::Xaml::Controls::TabViewItem Tab::GetTabViewItem()
+winrt::MUX::Controls::TabViewItem Tab::GetTabViewItem()
{
return _tabViewItem;
}
@@ -154,7 +156,7 @@ void Tab::UpdateIcon(const winrt::hstring iconPath)
_lastIconPath = iconPath;
_tabViewItem.Dispatcher().RunAsync(CoreDispatcherPriority::Normal, [this]() {
- _tabViewItem.Icon(GetColoredIcon(_lastIconPath));
+ _tabViewItem.IconSource(GetColoredIcon(_lastIconPath));
});
}
diff --git a/src/cascadia/TerminalApp/TabRowControl.cpp b/src/cascadia/TerminalApp/TabRowControl.cpp
index 18beaa4386d..bc4d7a83968 100644
--- a/src/cascadia/TerminalApp/TabRowControl.cpp
+++ b/src/cascadia/TerminalApp/TabRowControl.cpp
@@ -7,7 +7,7 @@
#include "TabRowControl.g.cpp"
using namespace winrt;
-using namespace Windows::UI::Xaml;
+using namespace winrt::Microsoft::UI::Xaml;
namespace winrt::TerminalApp::implementation
{
diff --git a/src/cascadia/TerminalApp/TabRowControl.h b/src/cascadia/TerminalApp/TabRowControl.h
index d6a45d81145..1dedf9edbf4 100644
--- a/src/cascadia/TerminalApp/TabRowControl.h
+++ b/src/cascadia/TerminalApp/TabRowControl.h
@@ -13,7 +13,7 @@ namespace winrt::TerminalApp::implementation
{
TabRowControl();
- void OnNewTabButtonClick(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::SplitButtonClickEventArgs const& args);
+ void OnNewTabButtonClick(Windows::Foundation::IInspectable const& sender, Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const& args);
};
}
diff --git a/src/cascadia/TerminalApp/TabRowControl.idl b/src/cascadia/TerminalApp/TabRowControl.idl
index 43c888ff3e8..1415df9a255 100644
--- a/src/cascadia/TerminalApp/TabRowControl.idl
+++ b/src/cascadia/TerminalApp/TabRowControl.idl
@@ -3,10 +3,9 @@
namespace TerminalApp
{
- [default_interface] runtimeclass TabRowControl : Windows.UI.Xaml.Controls.Grid
+ [default_interface] runtimeclass TabRowControl : Windows.UI.Xaml.Controls.ContentPresenter
{
TabRowControl();
- Windows.UI.Xaml.Controls.SplitButton NewTabButton { get; };
Microsoft.UI.Xaml.Controls.TabView TabView { get; };
}
}
diff --git a/src/cascadia/TerminalApp/TabRowControl.xaml b/src/cascadia/TerminalApp/TabRowControl.xaml
index 2eef3b9213d..2e7172fe2ce 100644
--- a/src/cascadia/TerminalApp/TabRowControl.xaml
+++ b/src/cascadia/TerminalApp/TabRowControl.xaml
@@ -1,6 +1,6 @@
-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
-
+
-
-
+
-
-
-
-
-
+ HorizontalAlignment="Left"
+ Content=""
+ UseLayoutRounding="true"
+ FontFamily="Segoe MDL2 Assets"
+ FontWeight="SemiLight"
+ FontSize="12">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp
index 4dcfa7251e6..4e0a38247e5 100644
--- a/src/cascadia/TerminalApp/TerminalPage.cpp
+++ b/src/cascadia/TerminalApp/TerminalPage.cpp
@@ -9,6 +9,7 @@
#include
#include "AzureCloudShellGenerator.h" // For AzureConnectionType
+#include "TabRowControl.h"
using namespace winrt;
using namespace winrt::Windows::UI::Xaml;
@@ -25,6 +26,7 @@ using namespace ::TerminalApp;
namespace winrt
{
namespace MUX = Microsoft::UI::Xaml;
+ namespace WUX = Windows::UI::Xaml;
using IInspectable = Windows::Foundation::IInspectable;
}
@@ -57,7 +59,9 @@ namespace winrt::TerminalApp::implementation
_tabContent = this->TabContent();
_tabRow = this->TabRow();
_tabView = _tabRow.TabView();
- _newTabButton = _tabRow.NewTabButton();
+
+ auto tabRowImpl = winrt::get_self(_tabRow);
+ _newTabButton = tabRowImpl->NewTabButton();
if (_settings->GlobalSettings().GetShowTabsInTitlebar())
{
@@ -78,8 +82,8 @@ namespace winrt::TerminalApp::implementation
this->_OpenNewTab(std::nullopt);
});
_tabView.SelectionChanged({ this, &TerminalPage::_OnTabSelectionChanged });
- _tabView.Items().VectorChanged({ this, &TerminalPage::_OnTabItemsChanged });
- _tabView.TabClosing({ this, &TerminalPage::_OnTabClosing });
+ _tabView.TabCloseRequested({ this, &TerminalPage::_OnTabCloseRequested });
+ _tabView.TabItemsChanged({ this, &TerminalPage::_OnTabItemsChanged });
_CreateNewTabFlyout();
_OpenNewTab(std::nullopt);
@@ -102,7 +106,7 @@ namespace winrt::TerminalApp::implementation
auto message = _resourceLoader->GetLocalizedString(contentKey);
auto buttonText = _resourceLoader->GetLocalizedString(L"Ok");
- Controls::ContentDialog dialog;
+ WUX::Controls::ContentDialog dialog;
dialog.Title(winrt::box_value(title));
dialog.Content(winrt::box_value(message));
dialog.CloseButtonText(buttonText);
@@ -169,14 +173,14 @@ namespace winrt::TerminalApp::implementation
const auto buttonText = _resourceLoader->GetLocalizedString(L"Ok");
- Controls::TextBlock aboutTextBlock;
+ WUX::Controls::TextBlock aboutTextBlock;
aboutTextBlock.Inlines().Append(about);
aboutTextBlock.Inlines().Append(gettingStartedLink);
aboutTextBlock.Inlines().Append(documentationLink);
aboutTextBlock.Inlines().Append(releaseNotesLink);
aboutTextBlock.IsTextSelectionEnabled(true);
- Controls::ContentDialog dialog;
+ WUX::Controls::ContentDialog dialog;
dialog.Title(winrt::box_value(title));
dialog.Content(aboutTextBlock);
dialog.CloseButtonText(buttonText);
@@ -197,7 +201,7 @@ namespace winrt::TerminalApp::implementation
auto primaryButtonText = _resourceLoader->GetLocalizedString(L"CloseAll");
auto secondaryButtonText = _resourceLoader->GetLocalizedString(L"Cancel");
- Controls::ContentDialog dialog;
+ WUX::Controls::ContentDialog dialog;
dialog.Title(winrt::box_value(title));
dialog.PrimaryButtonText(primaryButtonText);
@@ -215,7 +219,7 @@ namespace winrt::TerminalApp::implementation
// Below the profiles are the static menu items: settings, feedback
void TerminalPage::_CreateNewTabFlyout()
{
- auto newTabFlyout = Controls::MenuFlyout{};
+ auto newTabFlyout = WUX::Controls::MenuFlyout{};
auto keyBindings = _settings->GetKeybindings();
const GUID defaultProfileGuid = _settings->GlobalSettings().GetDefaultProfile();
@@ -224,7 +228,7 @@ namespace winrt::TerminalApp::implementation
for (int profileIndex = 0; profileIndex < profileCount; profileIndex++)
{
const auto& profile = _settings->GetProfiles()[profileIndex];
- auto profileMenuItem = Controls::MenuFlyoutItem{};
+ auto profileMenuItem = WUX::Controls::MenuFlyoutItem{};
// add the keyboard shortcuts for the first 9 profiles
if (profileIndex < 9)
@@ -248,7 +252,11 @@ namespace winrt::TerminalApp::implementation
// this flyout item.
if (profile.HasIcon())
{
- profileMenuItem.Icon(_GetIconFromProfile(profile));
+ auto iconSource = GetColoredIcon(profile.GetExpandedIconPath());
+
+ WUX::Controls::IconSourceElement iconElement;
+ iconElement.IconSource(iconSource);
+ profileMenuItem.Icon(iconElement);
}
if (profile.GetGuid() == defaultProfileGuid)
@@ -264,17 +272,17 @@ namespace winrt::TerminalApp::implementation
}
// add menu separator
- auto separatorItem = Controls::MenuFlyoutSeparator{};
+ auto separatorItem = WUX::Controls::MenuFlyoutSeparator{};
newTabFlyout.Items().Append(separatorItem);
// add static items
{
// Create the settings button.
- auto settingsItem = Controls::MenuFlyoutItem{};
+ auto settingsItem = WUX::Controls::MenuFlyoutItem{};
settingsItem.Text(_resourceLoader->GetLocalizedString(L"SettingsMenuItem"));
- Controls::SymbolIcon ico{};
- ico.Symbol(Controls::Symbol::Setting);
+ WUX::Controls::SymbolIcon ico{};
+ ico.Symbol(WUX::Controls::Symbol::Setting);
settingsItem.Icon(ico);
settingsItem.Click({ this, &TerminalPage::_SettingsButtonOnClick });
@@ -287,24 +295,24 @@ namespace winrt::TerminalApp::implementation
}
// Create the feedback button.
- auto feedbackFlyout = Controls::MenuFlyoutItem{};
+ auto feedbackFlyout = WUX::Controls::MenuFlyoutItem{};
feedbackFlyout.Text(_resourceLoader->GetLocalizedString(L"FeedbackMenuItem"));
- Controls::FontIcon feedbackIco{};
- feedbackIco.Glyph(L"\xE939");
- feedbackIco.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" });
- feedbackFlyout.Icon(feedbackIco);
+ WUX::Controls::FontIcon feedbackIcon{};
+ feedbackIcon.Glyph(L"\xE939");
+ feedbackIcon.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" });
+ feedbackFlyout.Icon(feedbackIcon);
feedbackFlyout.Click({ this, &TerminalPage::_FeedbackButtonOnClick });
newTabFlyout.Items().Append(feedbackFlyout);
// Create the about button.
- auto aboutFlyout = Controls::MenuFlyoutItem{};
+ auto aboutFlyout = WUX::Controls::MenuFlyoutItem{};
aboutFlyout.Text(_resourceLoader->GetLocalizedString(L"AboutMenuItem"));
- Controls::SymbolIcon aboutIco{};
- aboutIco.Symbol(Controls::Symbol::Help);
- aboutFlyout.Icon(aboutIco);
+ WUX::Controls::SymbolIcon aboutIcon{};
+ aboutIcon.Symbol(WUX::Controls::Symbol::Help);
+ aboutFlyout.Icon(aboutIcon);
aboutFlyout.Click({ this, &TerminalPage::_AboutButtonOnClick });
newTabFlyout.Items().Append(aboutFlyout);
@@ -319,8 +327,8 @@ namespace winrt::TerminalApp::implementation
// Shows the dropdown flyout.
void TerminalPage::_OpenNewTabDropdown()
{
- Controls::Primitives::FlyoutShowOptions options{};
- options.Placement(Controls::Primitives::FlyoutPlacementMode::BottomEdgeAlignedLeft);
+ WUX::Controls::Primitives::FlyoutShowOptions options{};
+ options.Placement(WUX::Controls::Primitives::FlyoutPlacementMode::BottomEdgeAlignedLeft);
_newTabButton.Flyout().ShowAt(_newTabButton, options);
}
@@ -396,7 +404,7 @@ namespace winrt::TerminalApp::implementation
_RegisterTerminalEvents(term, newTab);
auto tabViewItem = newTab->GetTabViewItem();
- _tabView.Items().Append(tabViewItem);
+ _tabView.TabItems().Append(tabViewItem);
// Set this profile's tab to the icon the user specified
if (profile != nullptr && profile->HasIcon())
@@ -632,10 +640,10 @@ namespace winrt::TerminalApp::implementation
// and call _RemoveTabViewItemByIndex
// Arguments:
// - tabViewItem: the TabViewItem in the TabView that is being removed.
- void TerminalPage::_RemoveTabViewItem(const IInspectable& tabViewItem)
+ void TerminalPage::_RemoveTabViewItem(const MUX::Controls::TabViewItem& tabViewItem)
{
uint32_t tabIndexFromControl = 0;
- _tabView.Items().IndexOf(tabViewItem, tabIndexFromControl);
+ _tabView.TabItems().IndexOf(tabViewItem, tabIndexFromControl);
_RemoveTabViewItemByIndex(tabIndexFromControl);
}
@@ -654,7 +662,7 @@ namespace winrt::TerminalApp::implementation
// Removing the tab from the collection will destroy its control and disconnect its connection.
_tabs.erase(_tabs.begin() + tabIndex);
- _tabView.Items().RemoveAt(tabIndex);
+ _tabView.TabItems().RemoveAt(tabIndex);
auto focusedTabIndex = _GetFocusedTabIndex();
if (tabIndex == focusedTabIndex)
@@ -785,7 +793,7 @@ namespace winrt::TerminalApp::implementation
// GH#1117: This is a workaround because _tabView.SelectedIndex()
// sometimes return incorrect result after removing some tabs
uint32_t focusedIndex;
- if (_tabView.Items().IndexOf(_tabView.SelectedItem(), focusedIndex))
+ if (_tabView.TabItems().IndexOf(_tabView.SelectedItem(), focusedIndex))
{
return focusedIndex;
}
@@ -954,20 +962,6 @@ namespace winrt::TerminalApp::implementation
_tabs[focusedTabIndex]->Scroll(termHeight * delta);
}
- // Method Description:
- // - Gets a colored IconElement for the profile in question. If the profile
- // has an `icon` set in the settings, this will return an icon with that
- // image in it. Otherwise it will return a nullptr-initialized
- // IconElement.
- // Arguments:
- // - profile: the profile to get the icon from
- // Return Value:
- // - an IconElement for the profile's icon, if it has one.
- Controls::IconElement TerminalPage::_GetIconFromProfile(const Profile& profile)
- {
- return profile.HasIcon() ? GetColoredIcon(profile.GetExpandedIconPath()) : Controls::IconElement{ nullptr };
- }
-
// Method Description:
// - Gets the title of the currently focused terminal control. If there
// isn't a control selected for any reason, returns "Windows Terminal"
@@ -1029,7 +1023,7 @@ namespace winrt::TerminalApp::implementation
// Takes into account a special case for an error condition for a comma
// Arguments:
// - MenuFlyoutItem that will be displayed, and a KeyChord to map an accelerator
- void TerminalPage::_SetAcceleratorForMenuItem(Controls::MenuFlyoutItem& menuItem,
+ void TerminalPage::_SetAcceleratorForMenuItem(WUX::Controls::MenuFlyoutItem& menuItem,
const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord)
{
#ifdef DEP_MICROSOFT_UI_XAML_708_FIXED
@@ -1194,7 +1188,7 @@ namespace winrt::TerminalApp::implementation
{
if (eventArgs.GetCurrentPoint(*this).Properties().IsMiddleButtonPressed())
{
- _RemoveTabViewItem(sender);
+ _RemoveTabViewItem(sender.as());
eventArgs.Handled(true);
}
}
@@ -1205,7 +1199,7 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - sender: the control that originated this event
// - eventArgs: the event's constituent arguments
- void TerminalPage::_OnTabSelectionChanged(const IInspectable& sender, const Controls::SelectionChangedEventArgs& eventArgs)
+ void TerminalPage::_OnTabSelectionChanged(const IInspectable& sender, const WUX::Controls::SelectionChangedEventArgs& eventArgs)
{
auto tabView = sender.as();
auto selectedIndex = tabView.SelectedIndex();
@@ -1257,13 +1251,10 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - sender: the control that originated this event
// - eventArgs: the event's constituent arguments
- void TerminalPage::_OnTabClosing(const IInspectable& sender, const MUX::Controls::TabViewTabClosingEventArgs& eventArgs)
+ void TerminalPage::_OnTabCloseRequested(const IInspectable& sender, const MUX::Controls::TabViewTabCloseRequestedEventArgs& eventArgs)
{
- const auto tabViewItem = eventArgs.Item();
+ const auto tabViewItem = eventArgs.Tab();
_RemoveTabViewItem(tabViewItem);
-
- // If we don't cancel the event, the TabView will remove the item itself.
- eventArgs.Cancel(true);
}
// Method Description:
@@ -1274,8 +1265,8 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - sender: unused
// - ContentDialogButtonClickEventArgs: unused
- void TerminalPage::_CloseWarningPrimaryButtonOnClick(Windows::UI::Xaml::Controls::ContentDialog /* sender */,
- Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs /* eventArgs*/)
+ void TerminalPage::_CloseWarningPrimaryButtonOnClick(WUX::Controls::ContentDialog /* sender */,
+ WUX::Controls::ContentDialogButtonClickEventArgs /* eventArgs*/)
{
_CloseAllTabs();
}
@@ -1340,5 +1331,5 @@ namespace winrt::TerminalApp::implementation
DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(TerminalPage, TitleChanged, _titleChangeHandlers, winrt::Windows::Foundation::IInspectable, winrt::hstring);
DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(TerminalPage, LastTabClosed, _lastTabClosedHandlers, winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::LastTabClosedEventArgs);
DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(TerminalPage, SetTitleBarContent, _setTitleBarContentHandlers, winrt::Windows::Foundation::IInspectable, UIElement);
- DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(TerminalPage, ShowDialog, _showDialogHandlers, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::Controls::ContentDialog);
+ DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(TerminalPage, ShowDialog, _showDialogHandlers, winrt::Windows::Foundation::IInspectable, WUX::Controls::ContentDialog);
}
diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h
index c76eb2227a7..dafec743fe6 100644
--- a/src/cascadia/TerminalApp/TerminalPage.h
+++ b/src/cascadia/TerminalApp/TerminalPage.h
@@ -54,7 +54,7 @@ namespace winrt::TerminalApp::implementation
Microsoft::UI::Xaml::Controls::TabView _tabView{ nullptr };
TerminalApp::TabRowControl _tabRow{ nullptr };
Windows::UI::Xaml::Controls::Grid _tabContent{ nullptr };
- Windows::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
+ Microsoft::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
std::shared_ptr<::TerminalApp::CascadiaSettings> _settings{ nullptr };
@@ -82,7 +82,7 @@ namespace winrt::TerminalApp::implementation
void _UpdateTabIcon(std::shared_ptr tab);
void _UpdateTabView();
void _DuplicateTabViewItem();
- void _RemoveTabViewItem(const IInspectable& tabViewItem);
+ void _RemoveTabViewItem(const Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem);
void _RemoveTabViewItemByIndex(uint32_t tabIndex);
void _RegisterTerminalEvents(Microsoft::Terminal::TerminalControl::TermControl term, std::shared_ptr hostingTab);
@@ -106,7 +106,6 @@ namespace winrt::TerminalApp::implementation
void _SplitPane(const Pane::SplitState splitType, const std::optional& profileGuid);
void _ResizePane(const Direction& direction);
void _ScrollPage(int delta);
- static Windows::UI::Xaml::Controls::IconElement _GetIconFromProfile(const ::TerminalApp::Profile& profile);
void _SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord);
void _CopyToClipboardHandler(const IInspectable& sender, const winrt::Microsoft::Terminal::TerminalControl::CopyToClipboardEventArgs& copiedData);
@@ -122,7 +121,7 @@ namespace winrt::TerminalApp::implementation
void _OnTabSelectionChanged(const IInspectable& sender, const Windows::UI::Xaml::Controls::SelectionChangedEventArgs& eventArgs);
void _OnTabItemsChanged(const IInspectable& sender, const Windows::Foundation::Collections::IVectorChangedEventArgs& eventArgs);
void _OnContentSizeChanged(const IInspectable& /*sender*/, Windows::UI::Xaml::SizeChangedEventArgs const& e);
- void _OnTabClosing(const IInspectable& sender, const Microsoft::UI::Xaml::Controls::TabViewTabClosingEventArgs& eventArgs);
+ void _OnTabCloseRequested(const IInspectable& sender, const Microsoft::UI::Xaml::Controls::TabViewTabCloseRequestedEventArgs& eventArgs);
void _RefreshUIForSettingsReload();
diff --git a/src/cascadia/TerminalApp/TitlebarControl.cpp b/src/cascadia/TerminalApp/TitlebarControl.cpp
index 01369fc5028..a34b6c9bd30 100644
--- a/src/cascadia/TerminalApp/TitlebarControl.cpp
+++ b/src/cascadia/TerminalApp/TitlebarControl.cpp
@@ -24,15 +24,14 @@ namespace winrt::TerminalApp::implementation
MinMaxCloseControl().CloseClick({ this, &TitlebarControl::Close_Click });
}
- Windows::UI::Xaml::UIElement TitlebarControl::Content()
+ IInspectable TitlebarControl::Content()
{
- return ContentRoot().Children().Size() > 0 ? ContentRoot().Children().GetAt(0) : nullptr;
+ return ContentRoot().Content();
}
- void TitlebarControl::Content(Windows::UI::Xaml::UIElement content)
+ void TitlebarControl::Content(IInspectable content)
{
- ContentRoot().Children().Clear();
- ContentRoot().Children().Append(content);
+ ContentRoot().Content(content);
}
void TitlebarControl::Root_SizeChanged(const IInspectable& sender,
diff --git a/src/cascadia/TerminalApp/TitlebarControl.h b/src/cascadia/TerminalApp/TitlebarControl.h
index 105807622f2..8f0bb7d4d0d 100644
--- a/src/cascadia/TerminalApp/TitlebarControl.h
+++ b/src/cascadia/TerminalApp/TitlebarControl.h
@@ -17,8 +17,8 @@ namespace winrt::TerminalApp::implementation
{
TitlebarControl(uint64_t handle);
- Windows::UI::Xaml::UIElement Content();
- void Content(Windows::UI::Xaml::UIElement content);
+ IInspectable Content();
+ void Content(IInspectable content);
void SetWindowVisualState(WindowVisualState visualState);
diff --git a/src/cascadia/TerminalApp/TitlebarControl.idl b/src/cascadia/TerminalApp/TitlebarControl.idl
index 477ad56b3c0..104f7a2f26f 100644
--- a/src/cascadia/TerminalApp/TitlebarControl.idl
+++ b/src/cascadia/TerminalApp/TitlebarControl.idl
@@ -15,7 +15,7 @@ namespace TerminalApp
TitlebarControl(UInt64 parentWindowHandle);
void SetWindowVisualState(WindowVisualState visualState);
- Windows.UI.Xaml.UIElement Content;
+ IInspectable Content;
Windows.UI.Xaml.Controls.Border DragBar { get; };
}
}
diff --git a/src/cascadia/TerminalApp/TitlebarControl.xaml b/src/cascadia/TerminalApp/TitlebarControl.xaml
index 19a6911f2fa..baa56950a70 100644
--- a/src/cascadia/TerminalApp/TitlebarControl.xaml
+++ b/src/cascadia/TerminalApp/TitlebarControl.xaml
@@ -13,7 +13,7 @@ the MIT License. See LICENSE in the project root for license information. -->
VerticalAlignment="Top"
SizeChanged="Root_SizeChanged"
d:DesignHeight="36"
- Background="{ThemeResource SystemChromeLowColor}"
+ Background="{ThemeResource TabViewBackground}"
d:DesignWidth="400">
-
+
(key);
}
-winrt::Windows::UI::Xaml::Controls::IconElement GetColoredIcon(const winrt::hstring& path);
-
// This is a pair of helpers for determining if a pair of guids are equal, and
// establishing an ordering on GUIDs (via std::less).
namespace std
@@ -53,3 +51,69 @@ namespace std
}
};
}
+
+namespace winrt::Microsoft::UI::Xaml::Controls
+{
+ struct IconSource;
+ struct BitmapIconSource;
+}
+
+namespace winrt::Windows::UI::Xaml::Controls
+{
+ struct IconSource;
+ struct BitmapIconSource;
+}
+
+namespace Microsoft::TerminalApp::details
+{
+ // This is a template that helps us figure out which BitmapIconSource to use for a given IconSource.
+ // We have to do this because some of our code still wants to use WUX IconSources.
+ template
+ struct BitmapIconSource
+ {
+ };
+
+ template<>
+ struct BitmapIconSource
+ {
+ using type = winrt::Microsoft::UI::Xaml::Controls::BitmapIconSource;
+ };
+
+ template<>
+ struct BitmapIconSource
+ {
+ using type = winrt::Windows::UI::Xaml::Controls::BitmapIconSource;
+ };
+}
+
+// Method Description:
+// - Creates an IconElement for the given path. The icon returned is a colored
+// icon. If we couldn't create the icon for any reason, we return an empty
+// IconElement.
+// Template Types:
+// - : The type of IconSource (MUX, WUX) to generate.
+// Arguments:
+// - path: the full, expanded path to the icon.
+// Return Value:
+// - An IconElement with its IconSource set, if possible.
+template
+TIconSource GetColoredIcon(const winrt::hstring& path)
+{
+ if (!path.empty())
+ {
+ try
+ {
+ winrt::Windows::Foundation::Uri iconUri{ path };
+ ::Microsoft::TerminalApp::details::BitmapIconSource::type iconSource;
+ // Make sure to set this to false, so we keep the RGB data of the
+ // image. Otherwise, the icon will be white for all the
+ // non-transparent pixels in the image.
+ iconSource.ShowAsMonochrome(false);
+ iconSource.UriSource(iconUri);
+ return iconSource;
+ }
+ CATCH_LOG();
+ }
+
+ return nullptr;
+}
diff --git a/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj b/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj
index 1fa8b3efa49..fdfba54b61e 100644
--- a/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj
+++ b/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj
@@ -275,19 +275,13 @@
x86
$(Platform)
- <_MUXRoot>$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\
+ <_MUXRoot>$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.2.190917002\
<_MUXAppRoot>$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\
- Microsoft.UI.Xaml.dll
- true
- false
- true
-
-
@@ -305,7 +299,7 @@
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
diff --git a/src/cascadia/TerminalApp/packages.config b/src/cascadia/TerminalApp/packages.config
index efa27692017..f5639eba8ef 100644
--- a/src/cascadia/TerminalApp/packages.config
+++ b/src/cascadia/TerminalApp/packages.config
@@ -1,6 +1,6 @@
-
+
diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp
index fdac4f28c51..ce876d7c0bc 100644
--- a/src/cascadia/TerminalControl/TermControl.cpp
+++ b/src/cascadia/TerminalControl/TermControl.cpp
@@ -84,8 +84,16 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
// Initialize the terminal only once the swapchainpanel is loaded - that
// way, we'll be able to query the real pixel size it got on layout
- _loadedRevoker = swapChainPanel.Loaded(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
- _InitializeTerminal();
+ _layoutUpdatedRevoker = swapChainPanel.LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
+ // This event fires every time the layout changes, but it is always the last one to fire
+ // in any layout change chain. That gives us great flexibility in finding the right point
+ // at which to initialize our renderer (and our terminal).
+ // Any earlier than the last layout update and we may not know the terminal's starting size.
+ if (_InitializeTerminal())
+ {
+ // Only let this succeed once.
+ this->_layoutUpdatedRevoker.revoke();
+ }
});
container.Children().Append(swapChainPanel);
@@ -382,16 +390,21 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
});
}
- void TermControl::_InitializeTerminal()
+ bool TermControl::_InitializeTerminal()
{
if (_initializedTerminal)
{
- return;
+ return false;
}
const auto windowWidth = _swapChainPanel.ActualWidth(); // Width() and Height() are NaN?
const auto windowHeight = _swapChainPanel.ActualHeight();
+ if (windowWidth == 0 || windowHeight == 0)
+ {
+ return false;
+ }
+
_terminal = std::make_unique<::Microsoft::Terminal::Core::Terminal>();
// First create the render thread.
@@ -565,6 +578,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
_connection.Start();
_initializedTerminal = true;
+ return true;
}
void TermControl::_CharacterHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/,
diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h
index 7f08565f355..ee3597ba46b 100644
--- a/src/cascadia/TerminalControl/TermControl.h
+++ b/src/cascadia/TerminalControl/TermControl.h
@@ -142,7 +142,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
// lest we get callbacks afterwards.
winrt::Windows::UI::Xaml::Controls::Control::SizeChanged_revoker _sizeChangedRevoker;
winrt::Windows::UI::Xaml::Controls::SwapChainPanel::CompositionScaleChanged_revoker _compositionScaleChangedRevoker;
- winrt::Windows::UI::Xaml::Controls::SwapChainPanel::Loaded_revoker _loadedRevoker;
+ winrt::Windows::UI::Xaml::Controls::SwapChainPanel::LayoutUpdated_revoker _layoutUpdatedRevoker;
winrt::Windows::UI::Xaml::UIElement::LostFocus_revoker _lostFocusRevoker;
winrt::Windows::UI::Xaml::UIElement::GotFocus_revoker _gotFocusRevoker;
@@ -150,7 +150,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
void _ApplyUISettings();
void _InitializeBackgroundBrush();
void _BackgroundColorChanged(const uint32_t color);
- void _InitializeTerminal();
+ bool _InitializeTerminal();
void _UpdateFont();
void _KeyDownHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
void _CharacterHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs const& e);
diff --git a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
index bb9ee0c057d..fc3d8edf2b6 100644
--- a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
+++ b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
@@ -72,7 +72,7 @@ void NonClientIslandWindow::Initialize()
_titlebar = winrt::TerminalApp::TitlebarControl{ reinterpret_cast(GetHandle()) };
_dragBar = _titlebar.DragBar();
- _rootGrid.SizeChanged({ this, &NonClientIslandWindow::OnDragBarSizeChanged });
+ _dragBar.SizeChanged({ this, &NonClientIslandWindow::OnDragBarSizeChanged });
_rootGrid.Children().Append(_titlebar);
@@ -110,14 +110,6 @@ void NonClientIslandWindow::SetContent(winrt::Windows::UI::Xaml::UIElement conte
void NonClientIslandWindow::SetTitlebarContent(winrt::Windows::UI::Xaml::UIElement content)
{
_titlebar.Content(content);
-
- // When the size of the titlebar content changes, we want to make sure to
- // update the size of the drag region as well.
- const auto fwe = content.try_as();
- if (fwe)
- {
- fwe.SizeChanged({ this, &NonClientIslandWindow::OnDragBarSizeChanged });
- }
}
RECT NonClientIslandWindow::GetDragAreaRect() const noexcept
diff --git a/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj b/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj
index 99309005df1..3e6da234028 100644
--- a/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj
+++ b/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj
@@ -103,12 +103,12 @@
true
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
diff --git a/src/cascadia/WindowsTerminal/packages.config b/src/cascadia/WindowsTerminal/packages.config
index 4541f9cac91..de3c00e3be3 100644
--- a/src/cascadia/WindowsTerminal/packages.config
+++ b/src/cascadia/WindowsTerminal/packages.config
@@ -2,6 +2,6 @@
-
+
diff --git a/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj b/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj
index 0cde6a7a2b5..d818c44aace 100644
--- a/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj
+++ b/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj
@@ -82,7 +82,7 @@
x86
$(Platform)
- <_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\runtimes\win10-$(Native-Platform)\native\"
+ <_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.2.190917002\runtimes\win10-$(Native-Platform)\native\"
@@ -110,13 +110,6 @@
echo OutDir=$(OutDir)
(xcopy /Y "$(OpenConsoleDir)src\cascadia\ut_app\TerminalApp.Unit.Tests.manifest" "$(OutDir)\TerminalApp.Unit.Tests.manifest*" )
(xcopy /Y "$(OpenConsoleDir)src\cascadia\ut_app\TerminalApp.Unit.Tests.AppxManifest.xml" "$(OutDir)\TerminalApp.Unit.Tests.AppxManifest.xml*" )
-
- (xcopy /Y $(_CppWinrtBinRoot)TerminalConnection\TerminalConnection.dll "$(OutDir)\TerminalConnection.dll*" )
- (xcopy /Y $(_CppWinrtBinRoot)TerminalSettings\TerminalSettings.dll "$(OutDir)\TerminalSettings.dll*" )
- (xcopy /Y $(_CppWinrtBinRoot)TerminalControl\TerminalControl.dll "$(OutDir)\TerminalControl.dll*" )
-
- (xcopy /Y $(_MUXBinRoot)Microsoft.UI.Xaml.dll "$(OutDir)\Microsoft.UI.Xaml.dll*" )
- (xcopy /Y $(_MUXBinRoot)Microsoft.UI.Xaml.pri "$(OutDir)\Microsoft.UI.Xaml.pri*" )