terminal/src/cascadia
Dustin L. Howett 4060a18937 Propagate IslandWindow's HWND into any component that needs it (#8391)
This fixes the issue with the settings UI where clicking the browse
buttons would cause an exception to be thrown when we tried to display a
picker without an originating HWND.

It turns out that pickers need a hosting/parent window, and Xaml Islands
doesn't furnish us with a CoreWindow that's set up for that use case.
Alas!

Raymond Chen's [blog post on the matter] suggests that we should
hand the HWND off through some classic COM interface. To do that
properly, Terminal's various components need to implement that interface
and propagate the HWND down where it's needed.

Thanks to a [Xaml compiler issue], we can't actually do that. To work
around that, we've begged and borrowed different methods for pushing
HWNDs around:

1. Using IInitializeWithWindow in secret
2. A member that takes a uint64
3. An interface that offers a function that will "wire up" the HWND.

I chose (1) because AppHost can implement IInitializeWithWindow, but
TerminalPage cannot. We're just pretending that TerminalPage _can_.

I chose (2) because none of the Xaml types in TerminalSettingsEditor can
implement the interface thanks to the aforementioned compiler issue, but
we don't have an escape hatch like AppHost that lives in the same module
and can help us do the propagation.

I chose (3) because I didn't want to commit the same sin as (2) _seven
times_ for every different type of settings page that exists. (3) is
backed by "IHostedInWindow", and anybody who knows they have to use
IInitializeWithWindow to tie an HWND to an object can call
IHostedInWindow.TryPropagateHostingWindow() on that object.

House of cards.

[Xaml compiler issue]: https://github.com/microsoft/microsoft-ui-xaml/issues/3331
[blog post on the matter]: https://devblogs.microsoft.com/oldnewthing/20190412-00/?p=102413

(cherry picked from commit f9fc9861a1)
2020-11-30 14:28:44 -08:00
..
CascadiaPackage Remove all our path antics; force native projects to bin/, obj/ (#8062) 2020-10-27 15:00:41 -07:00
inc Make Tab an unsealed runtimeclass (and rename it to TabBase) (#8153) 2020-11-04 10:15:05 -08:00
LocalTests_SettingsModel Teach Terminal to move tabs with key bindings (#8338) 2020-11-25 22:09:27 +00:00
LocalTests_TerminalApp Teach command palette to ignore case when sorting items (#8432) 2020-11-30 20:19:49 +00:00
PublicTerminalCore wpf: Add AutoFill to control whether the connection/buffer resizes (#7853) 2020-10-09 22:25:18 +00:00
ShellExtension Change backslashes in include statements to forward slashes (#8205) 2020-11-25 21:02:10 +00:00
TerminalApp Propagate IslandWindow's HWND into any component that needs it (#8391) 2020-11-30 14:28:44 -08:00
TerminalAzBridge Remove all our path antics; force native projects to bin/, obj/ (#8062) 2020-10-27 15:00:41 -07:00
TerminalConnection Azure: fall back to powershell when no preferred shell is set (#8197) 2020-11-09 14:55:45 -08:00
TerminalControl Change backslashes in include statements to forward slashes (#8205) 2020-11-25 21:02:10 +00:00
TerminalCore Add support for setting tabColor on the command line (#8102) 2020-11-19 20:36:18 -08:00
TerminalSettingsModel Teach Terminal to move tabs with key bindings (#8338) 2020-11-25 22:09:27 +00:00
UnitTests_TerminalCore Add support for setting tabColor on the command line (#8102) 2020-11-19 20:36:18 -08:00
ut_app Add Serializer to CascadiaSettings (#8018) 2020-11-17 00:37:19 +00:00
WindowsTerminal Propagate IslandWindow's HWND into any component that needs it (#8391) 2020-11-30 14:28:44 -08:00
WindowsTerminalUniversal Change backslashes in include statements to forward slashes (#8205) 2020-11-25 21:02:10 +00:00
WinRTUtils Remove all our path antics; force native projects to bin/, obj/ (#8062) 2020-10-27 15:00:41 -07:00
WpfTerminalControl wpf: add width/height checks when resizing the terminal (#7983) 2020-10-27 01:57:13 +00:00
WpfTerminalTestNetCore/WpfTerminalTestNetCore Fix 3 different bugs in the WPF control (#6464) 2020-06-11 18:05:43 +00:00
wt Build and ship an actual binary named wt that just launches WT (#6860) 2020-07-10 22:41:37 +00:00
CascadiaResources.build.items Introduce TerminalSettingsModel project (#7667) 2020-10-06 09:56:59 -07:00