From 2e9e4a59d9fc2e7f4367ba00d9d5afe4cd021d2b Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 25 Nov 2019 16:30:45 -0800 Subject: [PATCH] Introduce a Universal package for Windows Terminal (#3236) This PR creates a Universal entrypoint for the Windows Terminal solution in search of our goals to run everywhere, on all Windows platforms. The Universal entrypoint is relatively straightforward and mostly just invokes the App without any of the other islands and win32 boilerplate required for the centennial route. The Universal project is also its own packaging project all in one and will emit a relevant APPX. A few things were required to make this work correctly: * Vcxitems reuse of resources (and link instructions on all of them for proper pkg layout) * Move all Terminal project CRT usages to the app ones (and ensure forwarders are only Nugetted to the Centennial package to not pollute the Universal one) * Fix/delay dependencies in `TerminalApp` that are not available in the core platform (or don't have an appropriate existing platform forwarder... do a loader snaps check) * vcpkg needs updating for the Azure connection parser * font fallbacks because Consolas isn't necessarily there * fallbacks because there are environments without a window handle Some of those happened in other small PRs in the past week or two. They were relevant to this. Note, this isn't *useful* as such yet. You can run the Terminal in this context and even get some of the shells to work. But they don't do a whole lot yet. Scoping which shells appear in the profiles list and only offering those that contextually make sense is future work. * Break everything out of App except the base initialization for XAML. AppLogic is the new home. * deduplicate logics by always using the app one (since it has to be there to support universal launch). * apparently that was too many cross-boundary calls and we can cache it because winrt objects are magic. * Put UWP project into solution. * tabs in titlebar needs disabling from uwp context as the non-client is way different. This adds a method to signal that to logic and apply the setting override. * Change to use App CRT in preparation for universal. * Try to make project build again by setting winconpty to static lib so it'll use the CRT inside TerminalConnection (or its other consumers) instead of linking its own. * Remove test for conpty dll, it's a lib now. Add additional commentary on how CRT linking works for future reference. I'm sure this will come up again. * This fixes the build error. * use the _apiset variant until proven otherwise to match the existing one. * Merge branch 'master' into dev/miniksa/uwp3 * recorrect spacing in cppwinrt.build.pre.props * Add multiple additional fonts to fallback to. Also, guard for invalid window handle on title update. * Remove ARMs from solution. * Share items resources between centennial and universal project. * cleanup resources and split manifest for dev/release builds. * Rev entire solution to latest Toolkit (6.0.0 stable release). * shorten the items file using include patterns * cleanup this filters file a bit. * Fix C26445 by using string_view as value, not ref. Don't build Universal in Audit because we're not auditing app yet. * some PR feedback. document losing the pointer. get rid of 16.3.9 workarounds. improve consistency of variable decl in applogic.h * Make dev phone product ID not match prod phone ID. Fix universal package identity to match proposed license information. --- .gitignore | 3 + OpenConsole.sln | 29 ++ .../CascadiaPackage/CascadiaPackage.wapproj | 13 +- src/cascadia/CascadiaResources.build.items | 251 ++---------------- .../TerminalApp.LocalTests.vcxproj | 2 +- src/cascadia/TerminalApp/App.cpp | 1 + src/cascadia/TerminalApp/AppLogic.cpp | 15 ++ src/cascadia/TerminalApp/AppLogic.h | 3 + src/cascadia/TerminalApp/AppLogic.idl | 2 + src/cascadia/TerminalApp/TerminalApp.vcxproj | 2 +- .../TerminalApp/lib/TerminalAppLib.vcxproj | 4 +- src/cascadia/TerminalApp/packages.config | 2 +- .../WindowsTerminal/WindowsTerminal.vcxproj | 8 +- src/cascadia/WindowsTerminal/packages.config | 2 +- .../Package-Dev.appxmanifest | 47 ++++ .../Package.appxmanifest | 47 ++++ .../PropertySheet.props | 16 ++ .../Resources/en-US/Resources.resw | 138 ++++++++++ .../WindowsTerminalUniversal.vcxproj | 158 +++++++++++ .../WindowsTerminalUniversal.vcxproj.filters | 30 +++ .../WindowsTerminalUniversal/main.cpp | 18 ++ .../WindowsTerminalUniversal/packages.config | 5 + src/cascadia/WindowsTerminalUniversal/pch.cpp | 1 + src/cascadia/WindowsTerminalUniversal/pch.h | 11 + src/cppwinrt.build.pre.props | 2 +- src/renderer/dx/DxRenderer.cpp | 38 ++- 26 files changed, 579 insertions(+), 269 deletions(-) create mode 100644 src/cascadia/WindowsTerminalUniversal/Package-Dev.appxmanifest create mode 100644 src/cascadia/WindowsTerminalUniversal/Package.appxmanifest create mode 100644 src/cascadia/WindowsTerminalUniversal/PropertySheet.props create mode 100644 src/cascadia/WindowsTerminalUniversal/Resources/en-US/Resources.resw create mode 100644 src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj create mode 100644 src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj.filters create mode 100644 src/cascadia/WindowsTerminalUniversal/main.cpp create mode 100644 src/cascadia/WindowsTerminalUniversal/packages.config create mode 100644 src/cascadia/WindowsTerminalUniversal/pch.cpp create mode 100644 src/cascadia/WindowsTerminalUniversal/pch.h diff --git a/.gitignore b/.gitignore index 2fcb1c1d9d..2cbd304674 100644 --- a/.gitignore +++ b/.gitignore @@ -261,6 +261,9 @@ build*.rec build*.wrn build*.metadata +# MS Build binary logs +*.binlog + # .razzlerc.cmd file - used by dev environment tools/.razzlerc.* # .PowershellModules - if one needs a powershell module dependency, one diff --git a/OpenConsole.sln b/OpenConsole.sln index e397d4bd15..f1e9f4796b 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -250,6 +250,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RendererUia", "src\renderer EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinRTUtils", "src\cascadia\WinRTUtils\WinRTUtils.vcxproj", "{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsTerminalUniversal", "src\cascadia\WindowsTerminalUniversal\WindowsTerminalUniversal.vcxproj", "{B0AC39D6-7B40-49A9-8202-58549BAE1FB1}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winconpty.LIB", "src\winconpty\lib\winconptylib.vcxproj", "{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winconpty.DLL", "src\winconpty\dll\winconptydll.vcxproj", "{A22EC5F6-7851-4B88-AC52-47249D437A52}" @@ -1243,6 +1245,32 @@ Global {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Release|x64.Build.0 = Release|x64 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Release|x86.ActiveCfg = Release|Win32 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Release|x86.Build.0 = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|Any CPU.ActiveCfg = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|Any CPU.Build.0 = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|Any CPU.Deploy.0 = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|ARM64.ActiveCfg = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|ARM64.Build.0 = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|ARM64.Deploy.0 = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|x64.ActiveCfg = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|x86.ActiveCfg = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|x86.Build.0 = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.AuditMode|x86.Deploy.0 = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|ARM64.ActiveCfg = Debug|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|x64.ActiveCfg = Debug|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|x64.Build.0 = Debug|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|x64.Deploy.0 = Debug|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|x86.ActiveCfg = Debug|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|x86.Build.0 = Debug|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Debug|x86.Deploy.0 = Debug|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|Any CPU.ActiveCfg = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|ARM64.ActiveCfg = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|x64.ActiveCfg = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|x64.Build.0 = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|x64.Deploy.0 = Release|x64 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|x86.ActiveCfg = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|x86.Build.0 = Release|Win32 + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1}.Release|x86.Deploy.0 = Release|Win32 {58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32 {58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64 {58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.AuditMode|ARM64.Build.0 = AuditMode|ARM64 @@ -1347,6 +1375,7 @@ Global {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506} = {59840756-302F-44DF-AA47-441A9D673202} {48D21369-3D7B-4431-9967-24E81292CF63} = {05500DEF-2294-41E3-AF9A-24E580B82836} {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE} = {59840756-302F-44DF-AA47-441A9D673202} + {B0AC39D6-7B40-49A9-8202-58549BAE1FB1} = {59840756-302F-44DF-AA47-441A9D673202} {58A03BB2-DF5A-4B66-91A0-7EF3BA01269A} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB} {A22EC5F6-7851-4B88-AC52-47249D437A52} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB} EndGlobalSection diff --git a/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj b/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj index db75d65562..1c36d25e73 100644 --- a/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj +++ b/src/cascadia/CascadiaPackage/CascadiaPackage.wapproj @@ -45,16 +45,12 @@ so it's not in the common resource items. --> - - - - @@ -67,7 +63,6 @@ - - + $([MSBuild]::Unescape('$(WapProjBeforeGenerateAppxManifestDependsOn.Replace('_RemoveAllNonWapUWPItems', '_OpenConsoleRemoveAllNonWapUWPItems'))')) @@ -109,7 +102,6 @@ - @@ -118,5 +110,4 @@ - - + \ No newline at end of file diff --git a/src/cascadia/CascadiaResources.build.items b/src/cascadia/CascadiaResources.build.items index a06026669b..0f571f3a0d 100644 --- a/src/cascadia/CascadiaResources.build.items +++ b/src/cascadia/CascadiaResources.build.items @@ -1,248 +1,29 @@ - - Images\LargeTile.scale-100.png - - - Images\LargeTile.scale-125.png - - - Images\LargeTile.scale-150.png - - - Images\LargeTile.scale-200.png - - - Images\LargeTile.scale-400.png - - - Images\LockScreenLogo.scale-100.png - - - Images\LockScreenLogo.scale-125.png - - - Images\LockScreenLogo.scale-150.png - - - Images\LockScreenLogo.scale-200.png - - - Images\LockScreenLogo.scale-400.png - - - Images\SmallTile.scale-100.png - - - Images\SmallTile.scale-125.png - - - Images\SmallTile.scale-150.png - - - Images\SmallTile.scale-200.png - - - Images\SmallTile.scale-400.png - - - Images\SplashScreen.scale-100.png - - - Images\SplashScreen.scale-125.png - - - Images\SplashScreen.scale-150.png - - - Images\SplashScreen.scale-200.png - - - Images\SplashScreen.scale-400.png - - - Images\Square150x150Logo.scale-100.png - - - Images\Square150x150Logo.scale-125.png - - - Images\Square150x150Logo.scale-150.png - - - Images\Square150x150Logo.scale-200.png - - - Images\Square150x150Logo.scale-400.png - - - Images\Square44x44Logo.scale-100.png - - - Images\Square44x44Logo.scale-125.png - - - Images\Square44x44Logo.scale-150.png - - - Images\Square44x44Logo.scale-200.png - - - Images\Square44x44Logo.scale-400.png - - - Images\Square44x44Logo.targetsize-16.png - - - Images\Square44x44Logo.targetsize-16_altform-unplated.png - - - Images\Square44x44Logo.targetsize-20.png - - - Images\Square44x44Logo.targetsize-20_altform-unplated.png - - - Images\Square44x44Logo.targetsize-24.png - - - Images\Square44x44Logo.targetsize-24_altform-unplated.png - - - Images\Square44x44Logo.targetsize-256.png - - - Images\Square44x44Logo.targetsize-256_altform-unplated.png - - - Images\Square44x44Logo.targetsize-30.png - - - Images\Square44x44Logo.targetsize-30_altform-unplated.png - - - Images\Square44x44Logo.targetsize-32.png - - - Images\Square44x44Logo.targetsize-32_altform-unplated.png - - - Images\Square44x44Logo.targetsize-36.png - - - Images\Square44x44Logo.targetsize-36_altform-unplated.png - - - Images\Square44x44Logo.targetsize-40.png - - - Images\Square44x44Logo.targetsize-40_altform-unplated.png - - - Images\Square44x44Logo.targetsize-48.png - - - Images\Square44x44Logo.targetsize-48_altform-unplated.png - - - Images\Square44x44Logo.targetsize-60.png - - - Images\Square44x44Logo.targetsize-60_altform-unplated.png - - - Images\Square44x44Logo.targetsize-64.png - - - Images\Square44x44Logo.targetsize-64_altform-unplated.png - - - Images\Square44x44Logo.targetsize-72.png - - - Images\Square44x44Logo.targetsize-72_altform-unplated.png - - - Images\Square44x44Logo.targetsize-80.png - - - Images\Square44x44Logo.targetsize-80_altform-unplated.png - - - Images\Square44x44Logo.targetsize-96.png - - - Images\Square44x44Logo.targetsize-96_altform-unplated.png - - - Images\StoreLogo.scale-100.png - - - Images\StoreLogo.scale-125.png - - - Images\StoreLogo.scale-150.png - - - Images\StoreLogo.scale-200.png - - - Images\StoreLogo.scale-400.png - - - Images\Wide310x150Logo.scale-100.png - - - Images\Wide310x150Logo.scale-125.png - - - Images\Wide310x150Logo.scale-150.png - - - Images\Wide310x150Logo.scale-200.png - - - Images\Wide310x150Logo.scale-400.png + + + true + Images\%(RecursiveDir)%(FileName)%(Extension) - Cascadia.ttf + true + %(RecursiveDir)%(FileName)%(Extension) - - ProfileIcons\{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.scale-100.png - - - ProfileIcons\{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.scale-200.png - - - ProfileIcons\{574e775e-4f2a-5b96-ac1e-a2962a402336}.scale-100.png - - - ProfileIcons\{574e775e-4f2a-5b96-ac1e-a2962a402336}.scale-200.png - - - ProfileIcons\{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.scale-100.png - - - ProfileIcons\{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.scale-200.png - - - ProfileIcons\{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-100.png - - - ProfileIcons\{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-200.png - - - ProfileIcons\{b453ae62-4e3d-5e58-b989-0a998ec441b8}.scale-100.png - - - ProfileIcons\{b453ae62-4e3d-5e58-b989-0a998ec441b8}.scale-200.png + + true + ProfileIcons\%(RecursiveDir)%(FileName)%(Extension) - - defaults.json + + true + %(RecursiveDir)%(FileName)%(Extension) + + + + diff --git a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj index 43c9a78986..c6e281e02a 100644 --- a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj +++ b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj @@ -98,7 +98,7 @@ - + diff --git a/src/cascadia/TerminalApp/App.cpp b/src/cascadia/TerminalApp/App.cpp index 53800cdec3..51cb82c54e 100644 --- a/src/cascadia/TerminalApp/App.cpp +++ b/src/cascadia/TerminalApp/App.cpp @@ -50,6 +50,7 @@ namespace winrt::TerminalApp::implementation { auto logic = Logic(); logic.LoadSettings(); + logic.RunAsUwp(); logic.Create(); auto page = logic.GetRoot().as(); diff --git a/src/cascadia/TerminalApp/AppLogic.cpp b/src/cascadia/TerminalApp/AppLogic.cpp index b3e8c34b09..7e1233e53b 100644 --- a/src/cascadia/TerminalApp/AppLogic.cpp +++ b/src/cascadia/TerminalApp/AppLogic.cpp @@ -129,6 +129,14 @@ namespace winrt::TerminalApp::implementation _root = winrt::make_self(); } + // Method Description: + // - Called by UWP context invoker to let us know that we may have to change some of our behaviors + // for being a UWP + void AppLogic::RunAsUwp() + { + _isUwp = true; + } + // Method Description: // - Build the UI for the terminal app. Before this method is called, it // should not be assumed that the TerminalApp is usable. The Settings @@ -146,6 +154,13 @@ namespace winrt::TerminalApp::implementation _root->ShowDialog({ this, &AppLogic::_ShowDialog }); + // In UWP mode, we cannot handle taking over the title bar for tabs, + // so this setting is overriden to false no matter what the preference is. + if (_isUwp) + { + _settings->GlobalSettings().SetShowTabsInTitlebar(false); + } + _root->SetSettings(_settings, false); _root->Loaded({ this, &AppLogic::_OnLoaded }); _root->Create(); diff --git a/src/cascadia/TerminalApp/AppLogic.h b/src/cascadia/TerminalApp/AppLogic.h index 0689038051..66e5027d6e 100644 --- a/src/cascadia/TerminalApp/AppLogic.h +++ b/src/cascadia/TerminalApp/AppLogic.h @@ -28,6 +28,7 @@ namespace winrt::TerminalApp::implementation ~AppLogic() = default; void Create(); + void RunAsUwp(); void LoadSettings(); [[nodiscard]] std::shared_ptr<::TerminalApp::CascadiaSettings> GetSettings() const noexcept; @@ -48,6 +49,8 @@ namespace winrt::TerminalApp::implementation DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(RequestedThemeChanged, _requestedThemeChangedHandlers, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::ElementTheme); private: + bool _isUwp{ false }; + // If you add controls here, but forget to null them either here or in // the ctor, you're going to have a bad time. It'll mysteriously fail to // activate the AppLogic. diff --git a/src/cascadia/TerminalApp/AppLogic.idl b/src/cascadia/TerminalApp/AppLogic.idl index adb02d3b6d..8be0b6eada 100644 --- a/src/cascadia/TerminalApp/AppLogic.idl +++ b/src/cascadia/TerminalApp/AppLogic.idl @@ -22,6 +22,8 @@ namespace TerminalApp // registered?" when it definitely is. void Create(); + void RunAsUwp(); + void LoadSettings(); Windows.UI.Xaml.UIElement GetRoot(); diff --git a/src/cascadia/TerminalApp/TerminalApp.vcxproj b/src/cascadia/TerminalApp/TerminalApp.vcxproj index ba9433c04b..8c9a2861c2 100644 --- a/src/cascadia/TerminalApp/TerminalApp.vcxproj +++ b/src/cascadia/TerminalApp/TerminalApp.vcxproj @@ -96,4 +96,4 @@ - \ No newline at end of file + diff --git a/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj b/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj index f96dfc08d7..519fce75f2 100644 --- a/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj +++ b/src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj @@ -287,7 +287,7 @@ x86 $(Platform) <_MUXRoot>$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.2.191021001-prerelease\ - <_MUXAppRoot>$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\ + <_MUXAppRoot>$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\ @@ -317,7 +317,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 d5855bee13..d5f7bee705 100644 --- a/src/cascadia/TerminalApp/packages.config +++ b/src/cascadia/TerminalApp/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj b/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj index a89124dc59..d8576f6880 100644 --- a/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj +++ b/src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj @@ -1,6 +1,6 @@ - + {CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B} @@ -102,15 +102,15 @@ - + 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 c30bea8b7c..0e6d4e74bd 100644 --- a/src/cascadia/WindowsTerminal/packages.config +++ b/src/cascadia/WindowsTerminal/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/cascadia/WindowsTerminalUniversal/Package-Dev.appxmanifest b/src/cascadia/WindowsTerminalUniversal/Package-Dev.appxmanifest new file mode 100644 index 0000000000..80109bceb6 --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/Package-Dev.appxmanifest @@ -0,0 +1,47 @@ + + + + + + + + + ms-resource:AppNameDev + A Lone Developer + Images\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/WindowsTerminalUniversal/Package.appxmanifest b/src/cascadia/WindowsTerminalUniversal/Package.appxmanifest new file mode 100644 index 0000000000..b654ef77dd --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/Package.appxmanifest @@ -0,0 +1,47 @@ + + + + + + + + + ms-resource:AppName + Microsoft Corporation + Images\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/WindowsTerminalUniversal/PropertySheet.props b/src/cascadia/WindowsTerminalUniversal/PropertySheet.props new file mode 100644 index 0000000000..5942ba395b --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/PropertySheet.props @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/src/cascadia/WindowsTerminalUniversal/Resources/en-US/Resources.resw b/src/cascadia/WindowsTerminalUniversal/Resources/en-US/Resources.resw new file mode 100644 index 0000000000..506345b5d2 --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/Resources/en-US/Resources.resw @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The New Windows Terminal for Universal Platform + + + Windows Terminal Universal (Preview) + + + The Windows Terminal, but Unofficial and Universal + + + Windows Terminal Universal (Dev Build) + + + Terminal Universal + + + Terminal Universal (Dev) + + \ No newline at end of file diff --git a/src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj b/src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj new file mode 100644 index 0000000000..acdcc6e6bf --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj @@ -0,0 +1,158 @@ + + + + + + + true + true + true + {b0ac39d6-7b40-49a9-8202-58549bae1fb1} + WindowsTerminalUniversal + WindowsTerminalUniversal + en-US + 15.0 + true + Windows Store + 10.0 + 10.0.18362.0 + 10.0.18362.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + Application + v140 + v141 + v142 + Unicode + + + true + true + + + false + true + false + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + 4453;28204 + + + false + + + + + $(OpenConsoleDir)\src\inc;$(OpenConsoleDir)\dep;$(OpenConsoleDir)\dep\Console;$(OpenConsoleDir)\dep\Win32K;$(OpenConsoleDir)\dep\gsl\include;$(OpenConsoleDir)\dep\wil\include;%(AdditionalIncludeDirectories); + + + + "$(OpenConsoleDir)src\cascadia\TerminalCore\lib\Generated Files";"$(OpenConsoleDir)src\cascadia\TerminalApp\lib\Generated Files";%(AdditionalIncludeDirectories); + + + gdi32.lib;dwmapi.lib;Shcore.lib;%(AdditionalDependencies) + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + + + + + + Designer + + + Designer + + + + + + + + + + + + Create + + + + + + + + + {ca5cad1a-44bd-4ac7-ac72-f16e576fdd12} + + + + + + + + + + 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}. + + + + + + + \ No newline at end of file diff --git a/src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj.filters b/src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj.filters new file mode 100644 index 0000000000..c11c8cc4f3 --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + {4718a03b-f768-4d96-9106-096573a315a3} + + + {943541d5-c1da-435d-9f61-85d1b118f041} + + + + + Resources\en-US + + + \ No newline at end of file diff --git a/src/cascadia/WindowsTerminalUniversal/main.cpp b/src/cascadia/WindowsTerminalUniversal/main.cpp new file mode 100644 index 0000000000..7808afeab2 --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/main.cpp @@ -0,0 +1,18 @@ +#include "pch.h" + +#include "Generated Files\winrt\TerminalApp.h" + +int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) +{ + winrt::init_apartment(); + ::winrt::Windows::UI::Xaml::Application::Start( + [](auto&&) { + ::winrt::TerminalApp::App a; + + // We dump the pointer into nowhere here because it needs to not be deconstructed + // upon leaving the bottom of this lambda and the XAML Framework will catch the + // appropriate reference into App.Current for the remainder of execution. + ::winrt::detach_abi(a); + }); + return 0; +} diff --git a/src/cascadia/WindowsTerminalUniversal/packages.config b/src/cascadia/WindowsTerminalUniversal/packages.config new file mode 100644 index 0000000000..694e0dcdc3 --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/cascadia/WindowsTerminalUniversal/pch.cpp b/src/cascadia/WindowsTerminalUniversal/pch.cpp new file mode 100644 index 0000000000..bcb5590be1 --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/src/cascadia/WindowsTerminalUniversal/pch.h b/src/cascadia/WindowsTerminalUniversal/pch.h new file mode 100644 index 0000000000..ef6cfdff7c --- /dev/null +++ b/src/cascadia/WindowsTerminalUniversal/pch.h @@ -0,0 +1,11 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +#include "..\..\inc\LibraryIncludes.h" diff --git a/src/cppwinrt.build.pre.props b/src/cppwinrt.build.pre.props index f328a4a000..933055cd92 100644 --- a/src/cppwinrt.build.pre.props +++ b/src/cppwinrt.build.pre.props @@ -32,7 +32,7 @@ instead of the App platform. This you definitely want, because we're not building a true universal "app", we're building a desktop application with xaml. APIs like CreatePseudoConsole won't always be linkable without Desktop platform, - but we now carry our own copy of them in the winconpty library which works everywhere. + but we now carry our own copy of them in the winconpty library which works everywhere. For future reference, _VC_Target_Library_Platform can be configured to say which CRT to link against. Now that this doesn't say anything, the implicit is 'Store' which links against the App CRT. The alternative is 'Desktop' which links against the usual CRT redistributable. diff --git a/src/renderer/dx/DxRenderer.cpp b/src/renderer/dx/DxRenderer.cpp index ad1ef2fb5a..c952357a39 100644 --- a/src/renderer/dx/DxRenderer.cpp +++ b/src/renderer/dx/DxRenderer.cpp @@ -15,7 +15,7 @@ #pragma hdrstop static constexpr float POINTS_PER_INCH = 72.0f; -static constexpr std::wstring_view FALLBACK_FONT_FACE = L"Consolas"; +static constexpr std::wstring_view FALLBACK_FONT_FACES[] = { L"Consolas", L"Lucida Console", L"Courier New" }; static constexpr std::wstring_view FALLBACK_LOCALE = L"en-us"; using namespace Microsoft::Console::Render; @@ -1442,7 +1442,11 @@ float DxEngine::GetScaling() const noexcept // - S_OK [[nodiscard]] HRESULT DxEngine::_DoUpdateTitle(_In_ const std::wstring& /*newTitle*/) noexcept { - return PostMessageW(_hwndTarget, CM_UPDATE_TITLE, 0, 0) ? S_OK : E_FAIL; + if (_hwndTarget != INVALID_HANDLE_VALUE) + { + return PostMessageW(_hwndTarget, CM_UPDATE_TITLE, 0, 0) ? S_OK : E_FAIL; + } + return S_FALSE; } // Routine Description: @@ -1467,17 +1471,27 @@ float DxEngine::GetScaling() const noexcept if (!face) { - familyName = FALLBACK_FONT_FACE; - face = _FindFontFace(familyName, weight, stretch, style, localeName); - } + for (const auto fallbackFace : FALLBACK_FONT_FACES) + { + familyName = fallbackFace; + face = _FindFontFace(familyName, weight, stretch, style, localeName); - if (!face) - { - familyName = FALLBACK_FONT_FACE; - weight = DWRITE_FONT_WEIGHT_NORMAL; - stretch = DWRITE_FONT_STRETCH_NORMAL; - style = DWRITE_FONT_STYLE_NORMAL; - face = _FindFontFace(familyName, weight, stretch, style, localeName); + if (face) + { + break; + } + + familyName = fallbackFace; + weight = DWRITE_FONT_WEIGHT_NORMAL; + stretch = DWRITE_FONT_STRETCH_NORMAL; + style = DWRITE_FONT_STYLE_NORMAL; + face = _FindFontFace(familyName, weight, stretch, style, localeName); + + if (face) + { + break; + } + } } THROW_IF_NULL_ALLOC(face);