terminal/src/cascadia/WindowsTerminal
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
..
AppHost.cpp Propagate IslandWindow's HWND into any component that needs it (#8391) 2020-11-30 14:28:44 -08:00
AppHost.h Add a setting to flash the taskbar when the terminal emits BEL (#8215) 2020-11-18 22:55:10 +00:00
BaseWindow.h Tie up some A11y loose threads (#6417) 2020-06-10 15:15:26 +00:00
icon.cpp Update WT's icon at runtime to match high-contrast as applicable (#7971) 2020-10-28 00:39:38 +00:00
icon.h Update WT's icon at runtime to match high-contrast as applicable (#7971) 2020-10-28 00:39:38 +00:00
IslandWindow.cpp Add a setting to flash the taskbar when the terminal emits BEL (#8215) 2020-11-18 22:55:10 +00:00
IslandWindow.h Add a setting to flash the taskbar when the terminal emits BEL (#8215) 2020-11-18 22:55:10 +00:00
main.cpp Hook up the WIL fallback error tracer in Terminal (#7864) 2020-10-09 22:20:12 +00:00
NonClientIslandWindow.cpp 7012: top margin disappears upon resize in focus mode (#8140) 2020-11-03 17:40:02 +00:00
NonClientIslandWindow.h Add support for focus mode (#6804) 2020-07-13 17:40:20 +00:00
packages.config Update C++/WinRT to 2.0.201017.1 (#8061) 2020-10-27 20:15:30 +00:00
pch.cpp Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
pch.h Change backslashes in include statements to forward slashes (#8205) 2020-11-25 21:02:10 +00:00
resource.h Update WT's icon at runtime to match high-contrast as applicable (#7971) 2020-10-28 00:39:38 +00:00
WindowsTerminal.def Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
WindowsTerminal.manifest TURNS OUT CASE SENSITIVITY IS IMPORTANT (#2481) 2019-08-20 11:16:06 -07:00
WindowsTerminal.rc Update WT's icon at runtime to match high-contrast as applicable (#7971) 2020-10-28 00:39:38 +00:00
WindowsTerminal.vcxproj Update WT's icon at runtime to match high-contrast as applicable (#7971) 2020-10-28 00:39:38 +00:00