From 36c6b7748eb76cdd5791943f866df73b14728e09 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 24 Mar 2023 08:30:58 -0500 Subject: [PATCH] Clean up more warnings (#15039) * These `Icon` bindings were to `Profile`s which aren't Observable, but it also doesn't matter * More c# warnings hopefully we'll just jump straight to real errors now. --- .../TerminalSettingsEditor/AddProfile.xaml | 2 +- .../TerminalSettingsEditor/Launch.xaml | 4 +- .../WpfTerminalControl/TerminalContainer.cs | 49 +++++++++---------- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.xaml b/src/cascadia/TerminalSettingsEditor/AddProfile.xaml index 09237dd1b5..25a6bbc0a8 100644 --- a/src/cascadia/TerminalSettingsEditor/AddProfile.xaml +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.xaml @@ -60,7 +60,7 @@ + IconSource="{x:Bind Icon, Converter={StaticResource IconSourceConverter}}" /> diff --git a/src/cascadia/TerminalSettingsEditor/Launch.xaml b/src/cascadia/TerminalSettingsEditor/Launch.xaml index 0669a17bd9..1001f52770 100644 --- a/src/cascadia/TerminalSettingsEditor/Launch.xaml +++ b/src/cascadia/TerminalSettingsEditor/Launch.xaml @@ -57,7 +57,7 @@ + IconSource="{x:Bind Icon, Converter={StaticResource IconSourceConverter}}" /> @@ -104,7 +104,7 @@ Width="24" Height="24" VerticalAlignment="Center" - IconSource="{x:Bind Icon, Mode=OneWay, Converter={StaticResource IconSourceConverter}}" /> + IconSource="{x:Bind Icon, Converter={StaticResource IconSourceConverter}}" /> - /// WPF's HwndHost likes to mark the WM_GETOBJECT message as handled to - /// force the usage of the WPF automation peer. We explicitly mark it as - /// not handled and don't return an automation peer in "OnCreateAutomationPeer" below. - /// This forces the message to go down to the HwndTerminal where we return terminal's UiaProvider. - /// - /// - protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) - { - if (msg == (int)NativeMethods.WindowMessage.WM_GETOBJECT) - { - handled = false; - return IntPtr.Zero; - } - - return base.WndProc(hwnd, msg, wParam, lParam, ref handled); - } - - /// - protected override AutomationPeer OnCreateAutomationPeer() - { - return null; - } - /// /// Event that is fired when the terminal buffer scrolls from text output. /// @@ -274,6 +249,30 @@ namespace Microsoft.Terminal.Wpf } } + /// + /// WPF's HwndHost likes to mark the WM_GETOBJECT message as handled to + /// force the usage of the WPF automation peer. We explicitly mark it as + /// not handled and don't return an automation peer in "OnCreateAutomationPeer" below. + /// This forces the message to go down to the HwndTerminal where we return terminal's UiaProvider. + /// + /// + protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == (int)NativeMethods.WindowMessage.WM_GETOBJECT) + { + handled = false; + return IntPtr.Zero; + } + + return base.WndProc(hwnd, msg, wParam, lParam, ref handled); + } + + /// + protected override AutomationPeer OnCreateAutomationPeer() + { + return null; + } + /// protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi) {