Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,8 @@ namespace winrt::TerminalApp::implementation
}

auto icon = UI::IconPathConverter::IconWUX(iconSource);
icon.Width(32);
icon.Height(32);
Automation::AutomationProperties::SetAccessibilityView(icon, Automation::Peers::AccessibilityView::Raw);

return icon;
Expand Down Expand Up @@ -5356,6 +5358,8 @@ namespace winrt::TerminalApp::implementation
if (!icon.empty())
{
auto iconElement = UI::IconPathConverter::IconWUX(icon);
iconElement.Width(16);
iconElement.Height(16);
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
button.Icon(iconElement);
}
Expand All @@ -5374,6 +5378,8 @@ namespace winrt::TerminalApp::implementation
if (!icon.empty())
{
auto iconElement = UI::IconPathConverter::IconWUX(icon);
iconElement.Width(16);
iconElement.Height(16);
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
button.Icon(iconElement);
}
Expand All @@ -5394,6 +5400,8 @@ namespace winrt::TerminalApp::implementation
if (!icon.empty())
{
auto iconElement = UI::IconPathConverter::IconWUX(icon);
iconElement.Width(16);
iconElement.Height(16);
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
button.Icon(iconElement);
}
Expand Down Expand Up @@ -5564,6 +5572,8 @@ namespace winrt::TerminalApp::implementation
MenuFlyoutItem item{};

auto iconElement = UI::IconPathConverter::IconWUX(L"\ue74c");
iconElement.Width(16);
iconElement.Height(16);
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);

Expand Down
10 changes: 8 additions & 2 deletions src/cascadia/TerminalSettingsEditor/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
MUX::Controls::NavigationViewItem profileNavItem;
profileNavItem.Content(box_value(profile.Name()));
profileNavItem.Tag(box_value<Editor::ProfileViewModel>(profile));
profileNavItem.Icon(UI::IconPathConverter::IconWUX(profile.EvaluatedIcon()));
auto profileIcon = UI::IconPathConverter::IconWUX(profile.EvaluatedIcon());
profileIcon.Width(16);
profileIcon.Height(16);
profileNavItem.Icon(profileIcon);
WUX::Controls::ToolTipService::SetToolTip(profileNavItem, box_value(profile.Name()));

if (profile.Orphaned())
Expand All @@ -988,7 +991,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
const auto& tag{ menuItem.Tag().as<Editor::ProfileViewModel>() };
if (args.PropertyName() == L"Icon")
{
menuItem.Icon(UI::IconPathConverter::IconWUX(tag.EvaluatedIcon()));
auto updatedIcon = UI::IconPathConverter::IconWUX(tag.EvaluatedIcon());
updatedIcon.Width(16);
updatedIcon.Height(16);
menuItem.Icon(updatedIcon);
}
else if (args.PropertyName() == L"Name")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
return nullptr;
}
// IconWUX sets the icon width/height to 32 by default
auto icon = Microsoft::Terminal::UI::IconPathConverter::IconWUX(_CurrentFolder.Icon());
icon.Width(16);
icon.Height(16);
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation

Windows::UI::Xaml::Controls::IconElement ProfileViewModel::IconPreview() const
{
// IconWUX sets the icon width/height to 32 by default
auto icon = Microsoft::Terminal::UI::IconPathConverter::IconWUX(EvaluatedIcon());
icon.Width(16);
icon.Height(16);
Expand Down
7 changes: 3 additions & 4 deletions src/cascadia/TerminalSettingsEditor/SearchIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
else if (const auto extensionPackageVM = navigationArg.try_as<Editor::ExtensionPackageViewModel>())
{
// TODO GH #19806: IconWUX() sets a size on the icon automatically. This is great
// for most icons, but font icons end up being a weird size.
// Check if we're using the generic font icon, and, if so, just build it ourselves
// so that it looks right.
const auto& extPkgVMIconPath = extensionPackageVM.Icon();
if (extPkgVMIconPath == NavTagIconMap[extensionsTag])
{
// generic extension icon — build FontIcon directly so FontSize
// matches the other font icons in this list (iconSize, not the
// smaller default from IconWUX)
WUX::Controls::FontIcon icon{};
icon.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
icon.FontSize(iconSize);
Expand Down
2 changes: 0 additions & 2 deletions src/cascadia/UIHelpers/IconPathConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ namespace winrt::Microsoft::Terminal::UI::implementation

winrt::Microsoft::UI::Xaml::Controls::ImageIcon icon{};
icon.Source(bitmapSource);
icon.Width(32);
icon.Height(32);
return icon;
}
}
2 changes: 2 additions & 0 deletions src/cascadia/UIHelpers/IconPathConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace winrt::Microsoft::Terminal::UI::implementation
{
IconPathConverter() = default;

// Returns an unsized IconElement — callers are responsible for setting
// Width/Height to match their UI context.
static Windows::UI::Xaml::Controls::IconElement IconWUX(const winrt::hstring& iconPath);
static Windows::UI::Xaml::Controls::IconSource IconSourceWUX(const winrt::hstring& iconPath);
static Microsoft::UI::Xaml::Controls::IconSource IconSourceMUX(const winrt::hstring& iconPath, bool convertToGrayscale);
Expand Down
Loading