diff --git a/.github/actions/spelling/allow/apis.txt b/.github/actions/spelling/allow/apis.txt
index 3ffc52f9fb2..f7671d04f45 100644
--- a/.github/actions/spelling/allow/apis.txt
+++ b/.github/actions/spelling/allow/apis.txt
@@ -99,11 +99,9 @@ IImage
IInheritable
IMap
imm
-IMonarch
IObject
iosfwd
IPackage
-IPeasant
isa
ISetup
isspace
diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt
index 9d38873e30c..34bbd331916 100644
--- a/.github/actions/spelling/expect/expect.txt
+++ b/.github/actions/spelling/expect/expect.txt
@@ -173,6 +173,7 @@ CCom
CConsole
CCRT
cdd
+cds
CELLSIZE
cfae
cfie
@@ -280,6 +281,8 @@ contypes
conwinuserrefs
coordnew
COPYCOLOR
+COPYDATA
+COPYDATASTRUCT
CORESYSTEM
cotaskmem
countof
@@ -572,6 +575,7 @@ EOK
EPres
EQU
ERASEBKGND
+ERRORONEXIT
ESFCIB
esrp
ESV
diff --git a/OpenConsole.sln b/OpenConsole.sln
index a92c45a48ac..2534dbe9618 100644
--- a/OpenConsole.sln
+++ b/OpenConsole.sln
@@ -178,7 +178,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Terminal.Control"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsTerminal", "src\cascadia\WindowsTerminal\WindowsTerminal.vcxproj", "{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}"
ProjectSection(ProjectDependencies) = postProject
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE} = {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B} = {9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}
{CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32} = {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12} = {CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}
@@ -348,26 +347,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests_SettingsModel", "
{CA5CAD1A-F542-4635-A069-7CAEFB930070} = {CA5CAD1A-F542-4635-A069-7CAEFB930070}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MonarchPeasantSample", "src\tools\MonarchPeasantSample\MonarchPeasantSample.vcxproj", "{21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}"
- ProjectSection(ProjectDependencies) = postProject
- {18D09A24-8240-42D6-8CB6-236EEE820263} = {18D09A24-8240-42D6-8CB6-236EEE820263}
- EndProjectSection
-EndProject
-Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "MonarchPeasantPackage", "src\tools\MonarchPeasantPackage\MonarchPeasantPackage.wapproj", "{F75E29D0-D288-478B-8D83-2C190F321A3F}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Terminal.Remoting.Lib", "src\cascadia\Remoting\Microsoft.Terminal.RemotingLib.vcxproj", "{43CE4CE5-0010-4B99-9569-672670D26E26}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Terminal.Remoting", "src\cascadia\Remoting\dll\Microsoft.Terminal.Remoting.vcxproj", "{27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}"
- ProjectSection(ProjectDependencies) = postProject
- {43CE4CE5-0010-4B99-9569-672670D26E26} = {43CE4CE5-0010-4B99-9569-672670D26E26}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests_Remoting", "src\cascadia\UnitTests_Remoting\Remoting.UnitTests.vcxproj", "{68A10CD3-AA64-465B-AF5F-ED4E9700543C}"
- ProjectSection(ProjectDependencies) = postProject
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE} = {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}
- {43CE4CE5-0010-4B99-9569-672670D26E26} = {43CE4CE5-0010-4B99-9569-672670D26E26}
- EndProjectSection
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wpf", "wpf", "{4DAF0299-495E-4CD1-A982-9BAC16A45932}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenConsoleProxy", "src\host\proxy\Host.Proxy.vcxproj", "{71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF}"
@@ -1925,135 +1904,6 @@ Global
{CA5CAD1A-9B68-456A-B13E-C8218070DC42}.Release|x64.Build.0 = Release|x64
{CA5CAD1A-9B68-456A-B13E-C8218070DC42}.Release|x86.ActiveCfg = Release|Win32
{CA5CAD1A-9B68-456A-B13E-C8218070DC42}.Release|x86.Build.0 = Release|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.AuditMode|Any CPU.ActiveCfg = Debug|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.AuditMode|ARM64.ActiveCfg = Release|ARM64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.AuditMode|x64.ActiveCfg = Release|x64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.AuditMode|x86.ActiveCfg = Release|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|ARM64.Build.0 = Debug|ARM64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|x64.ActiveCfg = Debug|x64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|x64.Build.0 = Debug|x64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|x86.ActiveCfg = Debug|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Debug|x86.Build.0 = Debug|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|Any CPU.ActiveCfg = Release|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|ARM64.ActiveCfg = Release|ARM64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|ARM64.Build.0 = Release|ARM64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|x64.ActiveCfg = Release|x64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|x64.Build.0 = Release|x64
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|x86.ActiveCfg = Release|Win32
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D}.Release|x86.Build.0 = Release|Win32
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|Any CPU.ActiveCfg = Release|Any CPU
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|ARM64.ActiveCfg = Debug|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|ARM64.Build.0 = Debug|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|ARM64.Deploy.0 = Debug|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|x64.ActiveCfg = Debug|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|x64.Build.0 = Debug|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|x64.Deploy.0 = Debug|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|x86.ActiveCfg = Debug|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|x86.Build.0 = Debug|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.AuditMode|x86.Deploy.0 = Debug|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|ARM64.Build.0 = Debug|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|ARM64.Deploy.0 = Debug|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|x64.ActiveCfg = Debug|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|x64.Build.0 = Debug|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|x64.Deploy.0 = Debug|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|x86.ActiveCfg = Debug|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|x86.Build.0 = Debug|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Debug|x86.Deploy.0 = Debug|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Fuzzing|Any CPU.ActiveCfg = Release|Any CPU
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Fuzzing|x64.ActiveCfg = Release|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Fuzzing|x86.ActiveCfg = Release|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|ARM64.ActiveCfg = Release|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|ARM64.Build.0 = Release|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|ARM64.Deploy.0 = Release|ARM64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|x64.ActiveCfg = Release|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|x64.Build.0 = Release|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|x64.Deploy.0 = Release|x64
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|x86.ActiveCfg = Release|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|x86.Build.0 = Release|x86
- {F75E29D0-D288-478B-8D83-2C190F321A3F}.Release|x86.Deploy.0 = Release|x86
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|x64.ActiveCfg = Release|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|x64.Build.0 = Release|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|x86.ActiveCfg = AuditMode|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.AuditMode|x86.Build.0 = AuditMode|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|ARM64.Build.0 = Debug|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|x64.ActiveCfg = Debug|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|x64.Build.0 = Debug|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|x86.ActiveCfg = Debug|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Debug|x86.Build.0 = Debug|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|Any CPU.ActiveCfg = Release|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|ARM64.ActiveCfg = Release|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|ARM64.Build.0 = Release|ARM64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|x64.ActiveCfg = Release|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|x64.Build.0 = Release|x64
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|x86.ActiveCfg = Release|Win32
- {43CE4CE5-0010-4B99-9569-672670D26E26}.Release|x86.Build.0 = Release|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.AuditMode|x64.ActiveCfg = Release|x64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.AuditMode|x86.ActiveCfg = AuditMode|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.AuditMode|x86.Build.0 = AuditMode|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|ARM64.Build.0 = Debug|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|x64.ActiveCfg = Debug|x64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|x64.Build.0 = Debug|x64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|x86.ActiveCfg = Debug|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Debug|x86.Build.0 = Debug|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|Any CPU.ActiveCfg = Release|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|ARM64.ActiveCfg = Release|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|ARM64.Build.0 = Release|ARM64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|x64.ActiveCfg = Release|x64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|x64.Build.0 = Release|x64
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|x86.ActiveCfg = Release|Win32
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE}.Release|x86.Build.0 = Release|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.AuditMode|x64.ActiveCfg = AuditMode|x64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.AuditMode|x86.ActiveCfg = AuditMode|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.AuditMode|x86.Build.0 = AuditMode|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|ARM64.Build.0 = Debug|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|x64.ActiveCfg = Debug|x64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|x64.Build.0 = Debug|x64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|x86.ActiveCfg = Debug|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Debug|x86.Build.0 = Debug|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|Any CPU.ActiveCfg = Release|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|ARM64.ActiveCfg = Release|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|ARM64.Build.0 = Release|ARM64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|x64.ActiveCfg = Release|x64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|x64.Build.0 = Release|x64
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|x86.ActiveCfg = Release|Win32
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C}.Release|x86.Build.0 = Release|Win32
{71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32
{71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
{71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
@@ -2304,10 +2154,10 @@ Global
{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}.Release|x64.Build.0 = Release|x64
{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}.Release|x86.ActiveCfg = Release|Win32
{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}.Release|x86.Build.0 = Release|Win32
- {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|Any CPU.ActiveCfg = Debug|Win32
- {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|ARM64.ActiveCfg = Release|ARM64
- {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|x64.ActiveCfg = Release|x64
- {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|x86.ActiveCfg = Release|Win32
+ {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|Any CPU.ActiveCfg = AuditMode|x64
+ {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
+ {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|x64.ActiveCfg = AuditMode|x64
+ {7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.AuditMode|x86.ActiveCfg = AuditMode|Win32
{7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.Debug|Any CPU.ActiveCfg = Debug|x64
{7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.Debug|ARM64.ActiveCfg = Debug|ARM64
{7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}.Debug|ARM64.Build.0 = Debug|ARM64
@@ -2457,11 +2307,6 @@ Global
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907} = {77875138-BB08-49F9-8BB1-409C2150E0E1}
{CA5CAD1A-082C-4476-9F33-94B339494076} = {77875138-BB08-49F9-8BB1-409C2150E0E1}
{CA5CAD1A-9B68-456A-B13E-C8218070DC42} = {BDB237B6-1D1D-400F-84CC-40A58FA59C8E}
- {21B7EA5E-1EF8-49B6-AC07-11714AF0E37D} = {A10C4720-DCA4-4640-9749-67F4314F527C}
- {F75E29D0-D288-478B-8D83-2C190F321A3F} = {A10C4720-DCA4-4640-9749-67F4314F527C}
- {43CE4CE5-0010-4B99-9569-672670D26E26} = {2D17E75D-2DDC-42C4-AD70-704D95A937AE}
- {27B5AAEB-A548-44CF-9777-F8BAA32AF7AE} = {2D17E75D-2DDC-42C4-AD70-704D95A937AE}
- {68A10CD3-AA64-465B-AF5F-ED4E9700543C} = {BDB237B6-1D1D-400F-84CC-40A58FA59C8E}
{4DAF0299-495E-4CD1-A982-9BAC16A45932} = {59840756-302F-44DF-AA47-441A9D673202}
{71CC9D78-BA29-4D93-946F-BEF5D9A3A6EF} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB}
{2D17E75D-2DDC-42C4-AD70-704D95A937AE} = {59840756-302F-44DF-AA47-441A9D673202}
diff --git a/build/scripts/New-UnpackagedTerminalDistribution.ps1 b/build/scripts/New-UnpackagedTerminalDistribution.ps1
index 9605f132562..9f8d295be85 100644
--- a/build/scripts/New-UnpackagedTerminalDistribution.ps1
+++ b/build/scripts/New-UnpackagedTerminalDistribution.ps1
@@ -34,7 +34,7 @@ Param(
)
$filesToRemove = @("*.xml", "*.winmd", "Appx*", "Images/*Tile*", "Images/*Logo*") # Remove from Terminal
-$filesToKeep = @("Microsoft.Terminal.Remoting.winmd") # ... except for these
+$filesToKeep = @() # ... except for these
$filesToCopyFromXaml = @("Microsoft.UI.Xaml.dll", "Microsoft.UI.Xaml") # We don't need the .winmd
$ErrorActionPreference = 'Stop'
diff --git a/build/scripts/Test-WindowsTerminalPackage.ps1 b/build/scripts/Test-WindowsTerminalPackage.ps1
index b405d98c212..b492eca05f1 100644
--- a/build/scripts/Test-WindowsTerminalPackage.ps1
+++ b/build/scripts/Test-WindowsTerminalPackage.ps1
@@ -58,7 +58,7 @@ Try {
### Check the activatable class entries for a few DLLs we need.
$inProcServers = $Manifest.Package.Extensions.Extension.InProcessServer.Path
- $RequiredInProcServers = ("TerminalApp.dll", "Microsoft.Terminal.Control.dll", "Microsoft.Terminal.Remoting.dll", "Microsoft.Terminal.Settings.Editor.dll", "Microsoft.Terminal.Settings.Model.dll", "TerminalConnection.dll")
+ $RequiredInProcServers = ("TerminalApp.dll", "Microsoft.Terminal.Control.dll", "Microsoft.Terminal.Settings.Editor.dll", "Microsoft.Terminal.Settings.Model.dll", "TerminalConnection.dll")
Write-Verbose "InProc Servers: $inProcServers"
diff --git a/consolegit2gitfilters.json b/consolegit2gitfilters.json
index 3dbcfdc9a20..1d570f24975 100644
--- a/consolegit2gitfilters.json
+++ b/consolegit2gitfilters.json
@@ -24,8 +24,6 @@
"/doc/specs/",
"/doc/cascadia/",
"/doc/user-docs/",
- "/src/tools/MonarchPeasantSample/",
- "/src/tools/MonarchPeasantPackage/",
"/src/tools/ansi-color/",
"/src/tools/ColorTool/",
"/scratch/",
diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json
index 46eea7daed8..7834c55e7a9 100644
--- a/doc/cascadia/profiles.schema.json
+++ b/doc/cascadia/profiles.schema.json
@@ -2371,11 +2371,6 @@
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
"type": "boolean"
},
- "compatibility.isolatedMode": {
- "default": false,
- "description": "When set to true, Terminal windows will not be able to interact with each other (including global hotkeys, tab drag/drop, running commandlines in existing windows, etc.). This is a compatibility escape hatch for users who are running into certain windowing issues.",
- "type": "boolean"
- },
"compatibility.allowDECRQCRA": {
"default": false,
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
diff --git a/src/Terminal.wprp b/src/Terminal.wprp
index 1abe7df41a3..754cc1af260 100644
--- a/src/Terminal.wprp
+++ b/src/Terminal.wprp
@@ -10,7 +10,6 @@
-
@@ -30,7 +29,6 @@
-
@@ -51,7 +49,6 @@
-
diff --git a/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp b/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp
index f3c0efa463d..ff69ebf51ec 100644
--- a/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp
+++ b/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp
@@ -8,7 +8,6 @@
#include "../TerminalApp/TerminalPage.h"
#include "../TerminalApp/AppLogic.h"
#include "../TerminalApp/AppCommandlineArgs.h"
-#include "../inc/WindowingBehavior.h"
using namespace WEX::Logging;
using namespace WEX::Common;
@@ -74,10 +73,6 @@ namespace TerminalAppLocalTests
TEST_METHOD(TestMultipleSplitPaneSizes);
- TEST_METHOD(TestFindTargetWindow);
- TEST_METHOD(TestFindTargetWindowHelp);
- TEST_METHOD(TestFindTargetWindowVersion);
-
private:
void _buildCommandlinesHelper(AppCommandlineArgs& appArgs,
const size_t expectedSubcommands,
@@ -1934,209 +1929,4 @@ namespace TerminalAppLocalTests
}
}
}
-
- void CommandlineTest::TestFindTargetWindow()
- {
- {
- Log::Comment(L"wt.exe with no args should always use the value from"
- L" the settings (passed as the second argument).");
-
- std::vector args{ L"wt.exe" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseAnyExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"-w -1 should always result in a new window");
-
- std::vector args{ L"wt.exe", L"-w", L"-1" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"\"new\" should always result in a new window");
-
- std::vector args{ L"wt.exe", L"-w", L"new" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"-w with a negative number should always result in a "
- L"new window");
-
- std::vector args{ L"wt.exe", L"-w", L"-12345" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"-w with a positive number should result in us trying"
- L" to either make a new one or find an existing one "
- L"with that ID, depending on the provided argument");
-
- std::vector args{ L"wt.exe", L"-w", L"12345" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(12345, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(12345, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(12345, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"-w 0 should always use the \"current\" window");
-
- std::vector args{ L"wt.exe", L"-w", L"0" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseCurrent, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseCurrent, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseCurrent, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"-w last should always use the most recent window on "
- L"this desktop");
-
- std::vector args{ L"wt.exe", L"-w", L"last" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"Make sure we follow the provided argument when a "
- L"--window-id wasn't explicitly provided");
-
- std::vector args{ L"wt.exe", L"new-tab" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseAnyExisting, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- }
- {
- Log::Comment(L"Even if someone uses a subcommand as a window name, "
- L"that should work");
-
- std::vector args{ L"wt.exe", L"-w", L"new-tab" };
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseName, result.WindowId());
- VERIFY_ARE_EQUAL(L"new-tab", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseName, result.WindowId());
- VERIFY_ARE_EQUAL(L"new-tab", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseName, result.WindowId());
- VERIFY_ARE_EQUAL(L"new-tab", result.WindowName());
- }
- }
-
- void CommandlineTest::TestFindTargetWindowHelp()
- {
- Log::Comment(L"--help should always create a new window");
-
- // This is a little helper to make sure that these args _always_ return
- // UseNew, regardless of the windowing behavior.
- auto testHelper = [](auto&& args) {
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- };
-
- testHelper(std::vector{ L"wt.exe", L"--help" });
- testHelper(std::vector{ L"wt.exe", L"new-tab", L"--help" });
- testHelper(std::vector{ L"wt.exe", L"-w", L"0", L"new-tab", L"--help" });
- testHelper(std::vector{ L"wt.exe", L"-w", L"foo", L"new-tab", L"--help" });
- testHelper(std::vector{ L"wt.exe", L"new-tab", L";", L"--help" });
- }
-
- void CommandlineTest::TestFindTargetWindowVersion()
- {
- Log::Comment(L"--version should always create a new window");
-
- // This is a little helper to make sure that these args _always_ return
- // UseNew, regardless of the windowing behavior.
- auto testHelper = [](auto&& args) {
- auto result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseNew);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
-
- result = appImpl::AppLogic::_doFindTargetWindow({ args }, WindowingMode::UseAnyExisting);
- VERIFY_ARE_EQUAL(WindowingBehaviorUseNew, result.WindowId());
- VERIFY_ARE_EQUAL(L"", result.WindowName());
- };
-
- testHelper(std::vector{ L"wt.exe", L"--version" });
- }
}
diff --git a/src/cascadia/LocalTests_TerminalApp/TabTests.cpp b/src/cascadia/LocalTests_TerminalApp/TabTests.cpp
index d21497a51d9..477e6dcf0ea 100644
--- a/src/cascadia/LocalTests_TerminalApp/TabTests.cpp
+++ b/src/cascadia/LocalTests_TerminalApp/TabTests.cpp
@@ -1288,12 +1288,6 @@ namespace TerminalAppLocalTests
END_TEST_METHOD_PROPERTIES()
auto page = _commonSetup();
- page->RenameWindowRequested([&page](auto&&, auto&&) {
- // In the real terminal, this would bounce up to the monarch and
- // come back down. Instead, immediately call back to tell the terminal it failed.
- page->RenameFailed();
- });
-
auto windowNameChanged = false;
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
diff --git a/src/cascadia/Remoting/CommandlineArgs.cpp b/src/cascadia/Remoting/CommandlineArgs.cpp
deleted file mode 100644
index db763169328..00000000000
--- a/src/cascadia/Remoting/CommandlineArgs.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "pch.h"
-
-#include "CommandlineArgs.h"
-#include "CommandlineArgs.g.cpp"
-using namespace winrt;
-using namespace winrt::Microsoft::Terminal;
-using namespace winrt::Windows::Foundation;
-
-namespace winrt::Microsoft::Terminal::Remoting::implementation
-{
- // LOAD BEARING CODE
- // If you try to move this into the header, you will experience P A I N
- // It must be defined after CommandlineArgs.g.cpp, otherwise the compiler
- // will give you just the most impossible template errors to try and
- // decipher.
- void CommandlineArgs::Commandline(const winrt::array_view& value)
- {
- _args = { value.begin(), value.end() };
- }
-
- winrt::com_array CommandlineArgs::Commandline()
- {
- return winrt::com_array{ _args.begin(), _args.end() };
- }
-}
diff --git a/src/cascadia/Remoting/CommandlineArgs.h b/src/cascadia/Remoting/CommandlineArgs.h
deleted file mode 100644
index 2f618e53efc..00000000000
--- a/src/cascadia/Remoting/CommandlineArgs.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-
-#include "CommandlineArgs.g.h"
-
-namespace winrt::Microsoft::Terminal::Remoting::implementation
-{
- struct CommandlineArgs : public CommandlineArgsT
- {
- public:
- CommandlineArgs() :
- _args{},
- _cwd{ L"" }
- {
- }
-
- CommandlineArgs(const winrt::array_view& args,
- winrt::hstring currentDirectory,
- const uint32_t showWindowCommand,
- winrt::hstring envString) :
- _args{ args.begin(), args.end() },
- _cwd{ currentDirectory },
- _ShowWindowCommand{ showWindowCommand },
- CurrentEnvironment{ envString }
- {
- }
-
- winrt::hstring CurrentDirectory() { return _cwd; };
-
- void Commandline(const winrt::array_view& value);
- winrt::com_array Commandline();
-
- til::property CurrentEnvironment;
-
- WINRT_PROPERTY(uint32_t, ShowWindowCommand, SW_NORMAL); // SW_NORMAL is 1, 0 is SW_HIDE
-
- private:
- winrt::com_array _args;
- winrt::hstring _cwd;
- };
-
-}
-
-namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
-{
- BASIC_FACTORY(CommandlineArgs);
-}
diff --git a/src/cascadia/Remoting/FindTargetWindowArgs.cpp b/src/cascadia/Remoting/FindTargetWindowArgs.cpp
deleted file mode 100644
index 1781c1c9c12..00000000000
--- a/src/cascadia/Remoting/FindTargetWindowArgs.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-#include "pch.h"
-#include "FindTargetWindowArgs.h"
-#include "FindTargetWindowArgs.g.cpp"
diff --git a/src/cascadia/Remoting/FindTargetWindowArgs.h b/src/cascadia/Remoting/FindTargetWindowArgs.h
deleted file mode 100644
index b6dfc7638f7..00000000000
--- a/src/cascadia/Remoting/FindTargetWindowArgs.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*++
-Copyright (c) Microsoft Corporation
-Licensed under the MIT license.
-
-Class Name:
-- FindTargetWindowArgs.h
-
-Abstract:
-- This is a helper class for determining which window a specific commandline is
- intended for. The Monarch will create one of these, then toss it over to
- TerminalApp. TerminalApp actually contains the logic for parsing a
- commandline, as well as settings like the windowing behavior. Once the
- TerminalApp determines the correct window, it'll fill in the
- ResultTargetWindow property. The monarch will then read that value out to
- invoke the commandline in the appropriate window.
-
---*/
-
-#pragma once
-
-#include "FindTargetWindowArgs.g.h"
-
-namespace winrt::Microsoft::Terminal::Remoting::implementation
-{
- struct FindTargetWindowArgs : public FindTargetWindowArgsT
- {
- WINRT_PROPERTY(winrt::Microsoft::Terminal::Remoting::CommandlineArgs, Args, nullptr);
- WINRT_PROPERTY(int, ResultTargetWindow, -1);
- WINRT_PROPERTY(winrt::hstring, ResultTargetWindowName);
-
- public:
- FindTargetWindowArgs(winrt::Microsoft::Terminal::Remoting::CommandlineArgs args) :
- _Args{ args } {};
- };
-}
diff --git a/src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj b/src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj
deleted file mode 100644
index b5c7ada4790..00000000000
--- a/src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
- {43ce4ce5-0010-4b99-9569-672670d26e26}
- Win32Proj
- Microsoft.Terminal.Remoting.Lib
- Microsoft.Terminal.Remoting
- Microsoft.Terminal.Remoting.Lib
- StaticLibrary
- Console
- true
- true
-
-
-
-
-
-
-
- Monarch.idl
-
-
- Monarch.idl
-
-
- Monarch.idl
-
-
- Monarch.idl
-
-
- Peasant.idl
-
-
- Peasant.idl
-
-
- Peasant.idl
-
-
-
-
- Peasant.idl
-
-
- WindowManager.idl
-
-
- Peasant.idl
-
-
-
-
-
- Monarch.idl
-
-
- Monarch.idl
-
-
- Monarch.idl
-
-
- Monarch.idl
-
-
- Peasant.idl
-
-
- Peasant.idl
-
-
- Peasant.idl
-
-
- Create
-
-
- Peasant.idl
-
-
- WindowManager.idl
-
-
- Peasant.idl
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}
- false
-
-
-
-
-
-
- pch.h
-
-
- WindowsApp.lib;user32.lib;shell32.lib;%(AdditionalDependencies)
-
-
- false
-
-
-
-
-
-
-
-
-
diff --git a/src/cascadia/Remoting/Monarch.cpp b/src/cascadia/Remoting/Monarch.cpp
deleted file mode 100644
index b986bfc8630..00000000000
--- a/src/cascadia/Remoting/Monarch.cpp
+++ /dev/null
@@ -1,1114 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-
-#include "pch.h"
-#include "../inc/WindowingBehavior.h"
-#include "Monarch.h"
-#include "CommandlineArgs.h"
-#include "FindTargetWindowArgs.h"
-#include "ProposeCommandlineResult.h"
-
-#include "Monarch.g.cpp"
-#include "WindowRequestedArgs.g.cpp"
-#include "../../types/inc/utils.hpp"
-
-using namespace winrt;
-using namespace winrt::Microsoft::Terminal;
-using namespace winrt::Windows::Foundation;
-using namespace ::Microsoft::Console;
-
-namespace winrt::Microsoft::Terminal::Remoting::implementation
-{
- Monarch::Monarch() :
- _ourPID{ GetCurrentProcessId() }
- {
- try
- {
- _desktopManager = winrt::create_instance(__uuidof(VirtualDesktopManager));
- }
- CATCH_LOG();
- }
-
- // This constructor is intended to be used in unit tests,
- // but we need to make it public in order to use make_self
- // in the tests. It's not exposed through the idl though
- // so it's not _truly_ fully public which should be acceptable.
- Monarch::Monarch(const uint64_t testPID) :
- _ourPID{ testPID }
- {
- }
-
- Monarch::~Monarch() = default;
-
- uint64_t Monarch::GetPID()
- {
- return _ourPID;
- }
-
- // Method Description:
- // - Add the given peasant to the list of peasants we're tracking. This
- // Peasant may have already been assigned an ID. If it hasn't, then give
- // it an ID.
- // - NB: this takes a unique_lock on _peasantsMutex.
- // Arguments:
- // - peasant: the new Peasant to track.
- // Return Value:
- // - the ID assigned to the peasant.
- uint64_t Monarch::AddPeasant(Remoting::IPeasant peasant)
- {
- try
- {
- // TODO:projects/5 This is terrible. There's gotta be a better way
- // of finding the first opening in a non-consecutive map of int->object
- const auto providedID = peasant.GetID();
-
- if (providedID == 0)
- {
- // Peasant doesn't currently have an ID. Assign it a new one.
- peasant.AssignID(_nextPeasantID++);
- }
- else
- {
- // Peasant already had an ID (from an older monarch). Leave that one
- // be. Make sure that the next peasant's ID is higher than it.
- // If multiple peasants are added concurrently we keep trying to update
- // until we get to set the new id.
- uint64_t current;
- do
- {
- current = _nextPeasantID.load(std::memory_order_relaxed);
- } while (current <= providedID && !_nextPeasantID.compare_exchange_weak(current, providedID + 1, std::memory_order_relaxed));
- }
-
- auto newPeasantsId = peasant.GetID();
-
- // Keep track of which peasant we are
- // SAFETY: this is only true for one peasant, and each peasant
- // is only added to a monarch once, so we do not need synchronization here.
- if (peasant.GetPID() == _ourPID)
- {
- _ourPeasantId = newPeasantsId;
- }
- // Add an event listener to the peasant's WindowActivated event.
- peasant.WindowActivated({ this, &Monarch::_peasantWindowActivated });
- peasant.IdentifyWindowsRequested({ this, &Monarch::_identifyWindows });
- peasant.RenameRequested({ this, &Monarch::_renameRequested });
-
- peasant.ShowNotificationIconRequested([this](auto&&, auto&&) { ShowNotificationIconRequested.raise(*this, nullptr); });
- peasant.HideNotificationIconRequested([this](auto&&, auto&&) { HideNotificationIconRequested.raise(*this, nullptr); });
-
- {
- std::unique_lock lock{ _peasantsMutex };
- _peasants[newPeasantsId] = peasant;
- }
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_AddPeasant",
- TraceLoggingUInt64(providedID, "providedID", "the provided ID for the peasant"),
- TraceLoggingUInt64(newPeasantsId, "peasantID", "the ID of the new peasant"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- WindowCreated.raise(nullptr, nullptr);
- return newPeasantsId;
- }
- catch (...)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_AddPeasant_Failed",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- // We can only get into this try/catch if the peasant died on us. So
- // the return value doesn't _really_ matter. They're not about to
- // get it.
- return -1;
- }
- }
-
- // Method Description:
- // - Gives the host process an opportunity to run any pre-close logic then
- // requests all peasants to close.
- // Arguments:
- // - used
- // Return Value:
- // -
- void Monarch::QuitAll()
- {
- if (_quitting.exchange(true, std::memory_order_relaxed))
- {
- return;
- }
-
- const auto callback = [&](const auto& id, const auto& p) {
- // We want to tell our peasant to quit last, so that we don't try
- // to perform a bunch of elections on quit.
- if (id != _ourPeasantId)
- {
- p.Quit();
- }
- };
- const auto onError = [&](const auto& id) {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_handleQuitAll_Failed",
- TraceLoggingInt64(id, "peasantID", "The ID of the peasant which we could not close"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- };
-
- _forEachPeasant(callback, onError);
-
- {
- std::shared_lock lock{ _peasantsMutex };
- const auto peasantSearch = _peasants.find(_ourPeasantId);
- if (peasantSearch != _peasants.end())
- {
- peasantSearch->second.Quit();
- }
- }
- }
-
- // Method Description:
- // - Tells the monarch that a peasant is being closed.
- // - NB: this (separately) takes unique locks on _peasantsMutex and
- // _mruPeasantsMutex.
- // Arguments:
- // - peasantId: the id of the peasant
- // Return Value:
- // -
- void Monarch::SignalClose(const uint64_t peasantId)
- {
- // If we are quitting we don't care about maintaining our list of
- // peasants anymore, and don't need to notify the host that something
- // changed.
- if (_quitting.load(std::memory_order_relaxed))
- {
- return;
- }
-
- _clearOldMruEntries({ peasantId });
- {
- std::unique_lock lock{ _peasantsMutex };
- _peasants.erase(peasantId);
- }
- WindowClosed.raise(nullptr, nullptr);
- }
-
- // Method Description:
- // - Counts the number of living peasants.
- // Arguments:
- // -
- // Return Value:
- // - the number of active peasants.
- uint64_t Monarch::GetNumberOfPeasants()
- {
- std::shared_lock lock{ _peasantsMutex };
- return _peasants.size();
- }
-
- // Method Description:
- // - Event handler for the Peasant::WindowActivated event. Used as an
- // opportunity for us to update our internal stack of the "most recent
- // window".
- // Arguments:
- // - sender: the Peasant that raised this event. This might be out-of-proc!
- // - args: a bundle of the peasant ID, timestamp, and desktop ID, for the activated peasant
- // Return Value:
- // -
- void Monarch::_peasantWindowActivated(const winrt::Windows::Foundation::IInspectable& /*sender*/,
- const Remoting::WindowActivatedArgs& args)
- {
- HandleActivatePeasant(args);
- }
-
- // Method Description:
- // - Lookup a peasant by its ID. If the peasant has died, this will also
- // remove the peasant from our list of peasants.
- // - NB: this (separately) takes unique locks on _peasantsMutex and
- // _mruPeasantsMutex.
- // Arguments:
- // - peasantID: The ID Of the peasant to find
- // - clearMruPeasantOnFailure: When true this function will handle clearing
- // from _mruPeasants if a peasant was not found, otherwise the caller is
- // expected to handle that cleanup themselves.
- // Return Value:
- // - the peasant if it exists in our map, otherwise null
- Remoting::IPeasant Monarch::_getPeasant(uint64_t peasantID, bool clearMruPeasantOnFailure)
- {
- try
- {
- IPeasant maybeThePeasant = nullptr;
- {
- std::shared_lock lock{ _peasantsMutex };
- const auto peasantSearch = _peasants.find(peasantID);
- maybeThePeasant = peasantSearch == _peasants.end() ? nullptr : peasantSearch->second;
- }
- // Ask the peasant for their PID. This will validate that they're
- // actually still alive.
- if (maybeThePeasant)
- {
- maybeThePeasant.GetPID();
- }
- return maybeThePeasant;
- }
- catch (...)
- {
- LOG_CAUGHT_EXCEPTION();
-
- // Remove the peasant from the list of peasants
- {
- std::unique_lock lock{ _peasantsMutex };
- _peasants.erase(peasantID);
- }
-
- if (clearMruPeasantOnFailure)
- {
- // Remove the peasant from the list of MRU windows. They're dead.
- // They can't be the MRU anymore.
- _clearOldMruEntries({ peasantID });
- }
- return nullptr;
- }
- }
-
- // Method Description:
- // - Find the ID of the peasant with the given name. If no such peasant
- // exists, then we'll return 0. If we encounter any peasants who have died
- // during this process, then we'll remove them from the set of _peasants
- // Arguments:
- // - name: The window name to look for
- // Return Value:
- // - 0 if we didn't find the given peasant, otherwise a positive number for
- // the window's ID.
- uint64_t Monarch::_lookupPeasantIdForName(std::wstring_view name)
- {
- if (name.empty())
- {
- return 0;
- }
- if (name == L"new")
- {
- return 0;
- }
-
- uint64_t result = 0;
-
- const auto callback = [&](const auto& id, const auto& p) {
- auto otherName = p.WindowName();
- if (otherName == name)
- {
- result = id;
- return false;
- }
- return true;
- };
-
- const auto onError = [&](const auto& id) {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_lookupPeasantIdForName_Failed",
- TraceLoggingInt64(id, "peasantID", "The ID of the peasant which we could not get the name of"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- };
-
- _forEachPeasant(callback, onError);
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_lookupPeasantIdForName",
- TraceLoggingWideString(std::wstring{ name }.c_str(), "name", "the name we're looking for"),
- TraceLoggingUInt64(result, "peasantID", "the ID of the peasant with that name"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- return result;
- }
-
- // Method Description:
- // - Handler for the `Peasant::WindowActivated` event. We'll make a in-proc
- // copy of the WindowActivatedArgs from the peasant. That way, we won't
- // need to worry about the origin process dying when working with the
- // WindowActivatedArgs.
- // - If the peasant process dies while we're making this copy, then we'll
- // just log it and do nothing. We certainly don't want to track a dead
- // peasant.
- // - We'll pass that copy of the WindowActivatedArgs to
- // _doHandleActivatePeasant, which will actually insert the
- // WindowActivatedArgs into the list we're using to track the most recent
- // peasants.
- // Arguments:
- // - args: the WindowActivatedArgs describing when and where the peasant was activated.
- // Return Value:
- // -
- void Monarch::HandleActivatePeasant(const Remoting::WindowActivatedArgs& args)
- {
- if (args == nullptr)
- {
- // MSFT:35731327, GH #12624. There's a chance that the way the
- // window gets set up for defterm, the ActivatedArgs haven't been
- // created for this window yet. Check here and just ignore them if
- // they're null. They'll come back with real args soon
- return;
- }
- // Start by making a local copy of these args. It's easier for us if our
- // tracking of these args is all in-proc. That way, the only thing that
- // could fail due to the peasant dying is _this first copy_.
- winrt::com_ptr localArgs{ nullptr };
- try
- {
- localArgs = winrt::make_self(args);
- // This method will actually do the hard work
- _doHandleActivatePeasant(localArgs);
- }
- catch (...)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_HandleActivatePeasant_Failed",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- }
-
- // Method Description:
- // - Helper for removing a peasant from the list of MRU peasants. We want to
- // do this both when the peasant dies, and also when the peasant is newly
- // activated (so that we don't leave an old entry for it in the list).
- // - NB: This takes a unique lock on _mruPeasantsMutex.
- // Arguments:
- // - peasantIds: The list of peasant IDs to remove from the MRU list
- // Return Value:
- // -
- void Monarch::_clearOldMruEntries(const std::unordered_set& peasantIds)
- {
- if (peasantIds.size() == 0)
- {
- return;
- }
-
- std::unique_lock lock{ _mruPeasantsMutex };
- auto partition = std::remove_if(_mruPeasants.begin(), _mruPeasants.end(), [&](const auto& p) {
- const auto id = p.PeasantID();
- // remove the element if it was found in the list to erase.
- if (peasantIds.count(id) == 1)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_RemovedPeasantFromDesktop",
- TraceLoggingUInt64(id, "peasantID", "The ID of the peasant"),
- TraceLoggingGuid(p.DesktopID(), "desktopGuid", "The GUID of the previous desktop the window was on"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- return true;
- }
- return false;
- });
-
- // Remove everything that was in the list
- _mruPeasants.erase(partition, _mruPeasants.end());
- }
-
- // Method Description:
- // - Actually handle inserting the WindowActivatedArgs into our list of MRU windows.
- // - NB: this takes a unique_lock on _mruPeasantsMutex.
- // Arguments:
- // - localArgs: an in-proc WindowActivatedArgs that we should add to our list of MRU windows.
- // Return Value:
- // -
- void Monarch::_doHandleActivatePeasant(const winrt::com_ptr& localArgs)
- {
- // We're sure that localArgs isn't null here, we checked before in our
- // one caller (in Monarch::HandleActivatePeasant)
-
- const auto newLastActiveTime = localArgs->ActivatedTime().time_since_epoch().count();
-
- // * Check all the current lists to look for this peasant.
- // remove it from any where it exists.
- _clearOldMruEntries({ localArgs->PeasantID() });
-
- // * If the current desktop doesn't have a vector, add one.
- const auto desktopGuid{ localArgs->DesktopID() };
-
- {
- std::unique_lock lock{ _mruPeasantsMutex };
- // * Add this args list. By using lower_bound with insert, we can get it
- // into exactly the right spot, without having to re-sort the whole
- // array.
- _mruPeasants.insert(std::lower_bound(_mruPeasants.begin(),
- _mruPeasants.end(),
- *localArgs,
- [](const auto& first, const auto& second) { return first.ActivatedTime() > second.ActivatedTime(); }),
- *localArgs);
- }
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SetMostRecentPeasant",
- TraceLoggingUInt64(localArgs->PeasantID(), "peasantID", "the ID of the activated peasant"),
- TraceLoggingGuid(desktopGuid, "desktopGuid", "The GUID of the desktop the window is on"),
- TraceLoggingInt64(newLastActiveTime, "newLastActiveTime", "The provided localArgs->ActivatedTime()"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
-
- // Method Description:
- // - Retrieves the ID of the MRU peasant window. If requested, will limit
- // the search to windows that are on the current desktop.
- // - NB: This method will hold a shared lock on _mruPeasantsMutex and
- // potentially a unique_lock on _peasantsMutex at the same time.
- // Separately it might hold a unique_lock on _mruPeasantsMutex.
- // Arguments:
- // - limitToCurrentDesktop: if true, only return the MRU peasant that's
- // actually on the current desktop.
- // - ignoreQuakeWindow: if true, then don't return the _quake window when we
- // find it. This allows us to change our behavior for glomming vs
- // summoning. When summoning the window, this parameter should be true.
- // When glomming, this should be false, as to prevent glomming to the
- // _quake window.
- // Return Value:
- // - the ID of the most recent peasant, otherwise 0 if we could not find one.
- uint64_t Monarch::_getMostRecentPeasantID(const bool limitToCurrentDesktop, const bool ignoreQuakeWindow)
- {
- std::shared_lock lock{ _mruPeasantsMutex };
- if (_mruPeasants.empty())
- {
- // unlock the mruPeasants mutex to make sure we can't deadlock here.
- lock.unlock();
- // Only need a shared lock for read
- std::shared_lock peasantsLock{ _peasantsMutex };
- // We haven't yet been told the MRU peasant. Just use the first one.
- // This is just gonna be a random one, but really shouldn't happen
- // in practice. The WindowManager should set the MRU peasant
- // immediately as soon as it creates the monarch/peasant for the
- // first window.
- if (_peasants.size() > 0)
- {
- try
- {
- return _peasants.begin()->second.GetID();
- }
- catch (...)
- {
- // This shouldn't really happen. If we're the monarch, then the
- // first peasant should also _be us_. So we should be able to
- // get our own ID.
- return 0;
- }
- }
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_getMostRecentPeasantID_NoPeasants",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- return 0;
- }
-
- // Here, there's at least one MRU peasant.
- //
- // We're going to iterate over these peasants until we find one that both:
- // 1. Is alive
- // 2. Meets our selection criteria (do we care if it is on this desktop?)
- //
- // If the peasant is dead, then we'll remove it, and try the next one.
- // Once we find one that's alive, we'll either:
- // * check if we only want a peasant on the current desktop, and if so,
- // check if this peasant is on the current desktop.
- // - If it isn't on the current desktop, we'll loop again, on the
- // following peasant.
- // * If we don't care, then we'll just return that one.
- uint64_t result = 0;
- std::unordered_set peasantsToErase{};
- for (const auto& mruWindowArgs : _mruPeasants)
- {
- // Try to get the peasant, but do not have _getPeasant clean up old
- // _mruPeasants because we are iterating here.
- // SAFETY: _getPeasant can take a unique_lock on _peasantsMutex if
- // it detects a peasant is dead. Currently _getMostRecentPeasantId
- // is the only method that holds a lock on both _mruPeasantsMutex and
- // _peasantsMutex at the same time so there cannot be a deadlock here.
- const auto peasant{ _getPeasant(mruWindowArgs.PeasantID(), false) };
- if (!peasant)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_Collect_WasDead",
- TraceLoggingUInt64(mruWindowArgs.PeasantID(),
- "peasantID",
- "We thought this peasant was the MRU one, but it was actually already dead."),
- TraceLoggingGuid(mruWindowArgs.DesktopID(), "desktopGuid", "The GUID of the desktop the window is on"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- // We'll go through the loop again. We removed the current one
- // at positionInList, so the next one in positionInList will be
- // a new, different peasant.
- peasantsToErase.emplace(mruWindowArgs.PeasantID());
- continue;
- }
-
- if (ignoreQuakeWindow && peasant.WindowName() == QuakeWindowName)
- {
- // The _quake window should never be treated as the MRU window.
- // Skip it if we see it. Users can still target it with `wt -w
- // _quake`, which will hit `_lookupPeasantIdForName` instead.
- }
- else if (limitToCurrentDesktop && _desktopManager)
- {
- // Check if this peasant is actually on this desktop. We can't
- // simply get the GUID of the current desktop. We have to ask if
- // the HWND is on the current desktop.
- BOOL onCurrentDesktop{ false };
-
- // SUCCEEDED_LOG will log if it failed, and return true if it SUCCEEDED
- if (SUCCEEDED_LOG(_desktopManager->IsWindowOnCurrentVirtualDesktop(reinterpret_cast(mruWindowArgs.Hwnd()),
- &onCurrentDesktop)) &&
- onCurrentDesktop)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_Collect",
- TraceLoggingUInt64(mruWindowArgs.PeasantID(),
- "peasantID",
- "the ID of the MRU peasant for a desktop"),
- TraceLoggingGuid(mruWindowArgs.DesktopID(),
- "desktopGuid",
- "The GUID of the desktop the window is on"),
- TraceLoggingBoolean(limitToCurrentDesktop,
- "limitToCurrentDesktop",
- "True if we should only search for a window on the current desktop"),
- TraceLoggingBool(onCurrentDesktop,
- "onCurrentDesktop",
- "true if this window was in fact on the current desktop"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- result = mruWindowArgs.PeasantID();
- break;
- }
- // If this window wasn't on the current desktop, another one
- // might be. We'll increment positionInList below, and try
- // again.
- }
- else
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_getMostRecentPeasantID_Found",
- TraceLoggingUInt64(mruWindowArgs.PeasantID(), "peasantID", "The ID of the MRU peasant"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- result = mruWindowArgs.PeasantID();
- break;
- }
- }
-
- lock.unlock();
-
- if (peasantsToErase.size() > 0)
- {
- _clearOldMruEntries(peasantsToErase);
- }
-
- if (result == 0)
- {
- // Here, we've checked all the windows, and none of them was both alive
- // and the most recent (on this desktop). Just return 0 - the caller
- // will use this to create a new window.
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_getMostRecentPeasantID_NotFound",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
-
- return result;
- }
-
- // Method Description:
- // - Try to handle a commandline from a new WT invocation. We might need to
- // hand the commandline to an existing window, or we might need to tell
- // the caller that they need to become a new window to handle it themselves.
- // Arguments:
- // -
- // Return Value:
- // - true if the caller should create a new window for this commandline.
- // False otherwise - the monarch should have dispatched this commandline
- // to another window in this case.
- Remoting::ProposeCommandlineResult Monarch::ProposeCommandline(const Remoting::CommandlineArgs& args)
- {
- // Raise an event, to ask how to handle this commandline. We can't ask
- // the app ourselves - we exist isolated from that knowledge (and
- // dependency hell). The WindowManager will raise this up to the app
- // host, which will then ask the AppLogic, who will then parse the
- // commandline and determine the provided ID of the window.
- auto findWindowArgs{ winrt::make_self(args) };
-
- // This is handled by some handler in-proc
- FindTargetWindowRequested.raise(*this, *findWindowArgs);
-
- // After the event was handled, ResultTargetWindow() will be filled with
- // the parsed result.
- const auto targetWindow = findWindowArgs->ResultTargetWindow();
- const auto targetWindowName = findWindowArgs->ResultTargetWindowName();
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_ProposeCommandline",
- TraceLoggingInt64(targetWindow, "targetWindow", "The window ID the args specified"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- if (targetWindow == WindowingBehaviorUseNone)
- {
- // In this case, the targetWindow was UseNone, which means that we
- // want to make a message box, but otherwise not make a Terminal
- // window.
- return winrt::make(false);
- }
- // If there's a valid ID returned, then let's try and find the peasant
- // that goes with it. Alternatively, if we were given a magic windowing
- // constant, we can use that to look up an appropriate peasant.
- if (targetWindow >= 0 ||
- targetWindow == WindowingBehaviorUseName ||
- targetWindow == WindowingBehaviorUseExisting ||
- targetWindow == WindowingBehaviorUseAnyExisting)
- {
- uint64_t windowID = 0;
- switch (targetWindow)
- {
- case WindowingBehaviorUseCurrent:
- case WindowingBehaviorUseExisting:
- // TODO:projects/5 for now, just use the MRU window. Technically,
- // UseExisting and UseCurrent are different.
- // UseCurrent implies that we should try to do the WT_SESSION
- // lookup to find the window that spawned this process (then
- // fall back to sameDesktop if we can't find a match). For now,
- // it's good enough to just try to find a match on this desktop.
- //
- // GH#projects/5#card-60325142 - Don't try to glom to the quake window.
- windowID = _getMostRecentPeasantID(true, true);
- break;
- case WindowingBehaviorUseAnyExisting:
- windowID = _getMostRecentPeasantID(false, true);
- break;
- case WindowingBehaviorUseName:
- windowID = _lookupPeasantIdForName(targetWindowName);
- break;
- case WindowingBehaviorUseNone:
- // This should be impossible. The if statement above should have
- // prevented WindowingBehaviorUseNone from falling in here.
- // Explode, because this is a programming error.
- THROW_HR(E_UNEXPECTED);
- default:
- windowID = ::base::saturated_cast(targetWindow);
- break;
- }
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_ProposeCommandline",
- TraceLoggingInt64(windowID,
- "windowID",
- "The actual peasant ID we evaluated the window ID as"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- // If_getMostRecentPeasantID returns 0 above, then we couldn't find
- // a matching window for that style of windowing. _getPeasant will
- // return nullptr, and we'll fall through to the "create a new
- // window" branch below.
-
- if (auto targetPeasant{ _getPeasant(windowID) })
- {
- auto result{ winrt::make_self(false) };
- try
- {
- // This will raise the peasant's ExecuteCommandlineRequested
- // event, which will then ask the AppHost to handle the
- // commandline, which will then pass it to AppLogic for
- // handling.
- targetPeasant.ExecuteCommandline(args);
- }
- catch (...)
- {
- // If we fail to propose the commandline to the peasant (it
- // died?) then just tell this process to become a new window
- // instead.
- result->WindowName(targetWindowName);
- result->ShouldCreateWindow(true);
-
- RequestNewWindow.raise(*this, *winrt::make_self(*result, args));
-
- // If this fails, it'll be logged in the following
- // TraceLoggingWrite statement, with succeeded=false
- }
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_ProposeCommandline_Existing",
- TraceLoggingUInt64(windowID,
- "peasantID",
- "the ID of the peasant the commandline waws intended for"),
- TraceLoggingBoolean(true, "foundMatch", "true if we found a peasant with that ID"),
- TraceLoggingBoolean(!result->ShouldCreateWindow(),
- "succeeded",
- "true if we successfully dispatched the commandline to the peasant"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- return *result;
- }
- else if (windowID > 0)
- {
- // In this case, an ID was provided, but there's no
- // peasant with that ID. Instead, we should tell the caller that
- // they should make a new window, but _with that ID_.
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_ProposeCommandline_Existing",
- TraceLoggingUInt64(windowID,
- "peasantID",
- "the ID of the peasant the commandline waws intended for"),
- TraceLoggingBoolean(false, "foundMatch", "true if we found a peasant with that ID"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- auto result{ winrt::make_self(true) };
- result->Id(windowID);
- result->WindowName(targetWindowName);
-
- RequestNewWindow.raise(*this, *winrt::make_self(*result, args));
-
- return *result;
- }
- }
-
- // If we get here, we couldn't find an existing window. Make a new one.
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_ProposeCommandline_NewWindow",
- TraceLoggingInt64(targetWindow, "targetWindow", "The provided ID"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- // In this case, no usable ID was provided. Return { true, nullopt }
- auto result = winrt::make_self(true);
- result->WindowName(targetWindowName);
-
- RequestNewWindow.raise(*this, *winrt::make_self(*result, args));
-
- return *result;
- }
-
- // Method Description:
- // - This is an event handler for the IdentifyWindowsRequested event. A
- // Peasant may raise that event if they want _all_ windows to identify
- // themselves.
- // - This will tell each and every peasant to identify themselves. This will
- // eventually propagate down to TerminalPage::IdentifyWindow.
- // Arguments:
- // -
- // Return Value:
- // -
- void Monarch::_identifyWindows(const winrt::Windows::Foundation::IInspectable& /*sender*/,
- const winrt::Windows::Foundation::IInspectable& /*args*/)
- {
- // Notify all the peasants to display their ID.
- const auto callback = [&](const auto& /*id*/, const auto& p) {
- p.DisplayWindowId();
- };
- const auto onError = [&](const auto& id) {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_identifyWindows_Failed",
- TraceLoggingInt64(id, "peasantID", "The ID of the peasant which we could not identify"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- };
-
- _forEachPeasant(callback, onError);
- }
-
- // Method Description:
- // - This is an event handler for the RenameRequested event. A
- // Peasant may raise that event when they want to be renamed to something else.
- // - We will check if there are any other windows with this name. If there
- // are, then we'll reject the rename by setting args.Succeeded=false.
- // - If there aren't any other windows with this name, then we'll set
- // args.Succeeded=true, allowing the window to keep this name.
- // Arguments:
- // - args: Contains the requested window name and a boolean (Succeeded)
- // indicating if the request was successful.
- // Return Value:
- // -
- void Monarch::_renameRequested(const winrt::Windows::Foundation::IInspectable& /*sender*/,
- const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args)
- {
- auto successfullyRenamed = false;
-
- try
- {
- args.Succeeded(false);
- const auto name{ args.NewName() };
- // Try to find a peasant that currently has this name
- const auto id = _lookupPeasantIdForName(name);
- if (_getPeasant(id) == nullptr)
- {
- // If there is one, then oh no! The requestor is not allowed to
- // be renamed.
- args.Succeeded(true);
- successfullyRenamed = true;
- }
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_renameRequested",
- TraceLoggingWideString(name.c_str(), "name", "The newly proposed name"),
- TraceLoggingInt64(successfullyRenamed, "successfullyRenamed", "true if the peasant is allowed to rename themselves to that name."),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- catch (...)
- {
- LOG_CAUGHT_EXCEPTION();
- // If this fails, we don't _really_ care. The peasant died, but
- // they're the only one who cares about the result.
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_renameRequested_Failed",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- }
-
- // Method Description:
- // - Attempt to summon a window. `args` contains information about which
- // window we should try to summon:
- // * if a WindowName is provided, we'll try to find a window with exactly
- // that name, and fail if there isn't one.
- // - Calls Peasant::Summon on the matching peasant (which might be an RPC call)
- // - This should only ever be called by the WindowManager in the monarch
- // process itself. The monarch is the one registering for global hotkeys,
- // so it's the one calling this method.
- // Arguments:
- // - args: contains information about the window that should be summoned.
- // Return Value:
- // -
- // - Sets args.FoundMatch when a window matching args is found successfully.
- void Monarch::SummonWindow(const Remoting::SummonWindowSelectionArgs& args)
- {
- const auto searchedForName{ args.WindowName() };
- try
- {
- args.FoundMatch(false);
-
- // If a WindowID is provided from the args, use that first.
- uint64_t windowId = 0;
- if (args.WindowID())
- {
- windowId = args.WindowID().Value();
- }
- else
- {
- // If no name was provided, then just summon the MRU window.
- if (searchedForName.empty())
- {
- // Use the value of the `desktop` arg to determine if we should
- // limit to the current desktop (desktop:onCurrent) or not
- // (desktop:any or desktop:toCurrent)
- windowId = _getMostRecentPeasantID(args.OnCurrentDesktop(), false);
- }
- else
- {
- // Try to find a peasant that currently has this name
- windowId = _lookupPeasantIdForName(searchedForName);
- }
- }
-
- if (auto targetPeasant{ _getPeasant(windowId) })
- {
- targetPeasant.Summon(args.SummonBehavior());
- args.FoundMatch(true);
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SummonWindow_Success",
- TraceLoggingWideString(searchedForName.c_str(), "searchedForName", "The name of the window we tried to summon"),
- TraceLoggingUInt64(windowId, "peasantID", "The id of the window we tried to summon"),
- TraceLoggingBoolean(args.OnCurrentDesktop(), "OnCurrentDesktop", "true iff the window needs to be on the current virtual desktop"),
- TraceLoggingBoolean(args.SummonBehavior().MoveToCurrentDesktop(), "MoveToCurrentDesktop", "if true, move the window to the current virtual desktop"),
- TraceLoggingBoolean(args.SummonBehavior().ToggleVisibility(), "ToggleVisibility", "true if we should toggle the visibility of the window"),
- TraceLoggingUInt32(args.SummonBehavior().DropdownDuration(), "DropdownDuration", "the duration to dropdown the window"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- else
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SummonWindow_NoPeasant",
- TraceLoggingWideString(searchedForName.c_str(), "searchedForName", "The name of the window we tried to summon"),
- TraceLoggingUInt64(windowId, "peasantID", "The id of the window we tried to summon"),
- TraceLoggingBoolean(args.OnCurrentDesktop(), "OnCurrentDesktop", "true iff the window needs to be on the current virtual desktop"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- }
- catch (...)
- {
- LOG_CAUGHT_EXCEPTION();
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SummonWindow_Failed",
- TraceLoggingWideString(searchedForName.c_str(), "searchedForName", "The name of the window we tried to summon"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- }
-
- // Method Description:
- // - This method creates a map of peasant IDs to peasant names
- // while removing dead peasants.
- // Arguments:
- // -
- // Return Value:
- // - A map of peasant IDs to their names.
- Windows::Foundation::Collections::IVectorView Monarch::GetPeasantInfos()
- {
- std::vector names;
- {
- std::shared_lock lock{ _peasantsMutex };
- names.reserve(_peasants.size());
- }
-
- const auto func = [&](const auto& id, const auto& p) -> void {
- names.push_back({ id, p.WindowName(), p.ActiveTabTitle() });
- };
-
- const auto onError = [&](const auto& id) {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_identifyWindows_Failed",
- TraceLoggingInt64(id, "peasantID", "The ID of the peasant which we could not identify"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- };
-
- _forEachPeasant(func, onError);
-
- return winrt::single_threaded_vector(std::move(names)).GetView();
- }
-
- bool Monarch::DoesQuakeWindowExist()
- {
- auto result = false;
- const auto func = [&](const auto& /*id*/, const auto& p) {
- if (p.WindowName() == QuakeWindowName)
- {
- result = true;
- }
- // continue if we didn't get a positive result
- return !result;
- };
-
- const auto onError = [&](const auto& id) {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_DoesQuakeWindowExist_Failed",
- TraceLoggingInt64(id, "peasantID", "The ID of the peasant which we could not ask for its name"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- };
-
- _forEachPeasant(func, onError);
- return result;
- }
-
- void Monarch::SummonAllWindows()
- {
- const auto func = [&](const auto& /*id*/, const auto& p) {
- SummonWindowBehavior args{};
- args.ToggleVisibility(false);
- p.Summon(args);
- };
-
- const auto onError = [&](const auto& id) {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SummonAll_Failed",
- TraceLoggingInt64(id, "peasantID", "The ID of the peasant which we could not summon"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- };
-
- _forEachPeasant(func, onError);
- }
-
- void Monarch::RequestMoveContent(winrt::hstring window,
- winrt::hstring content,
- uint32_t tabIndex,
- const Windows::Foundation::IReference& windowBounds)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_MoveContent_Requested",
- TraceLoggingWideString(window.c_str(), "window", "The name of the window we tried to move to"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- uint64_t windowId = _lookupPeasantIdForName(window);
- if (windowId == 0)
- {
- // Try the name as an integer ID
- uint32_t temp;
- if (!Utils::StringToUint(window.c_str(), temp))
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_MoveContent_FailedToParseId",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- else
- {
- windowId = temp;
- }
- }
-
- if (auto targetPeasant{ _getPeasant(windowId) })
- {
- auto request = winrt::make_self(content, tabIndex);
- targetPeasant.AttachContentToWindow(*request);
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_MoveContent_Completed",
- TraceLoggingInt64(windowId, "windowId", "The ID of the peasant which we sent the content to"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- else
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_MoveContent_NoWindow",
- TraceLoggingInt64(windowId, "windowId", "We could not find a peasant with this ID"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- // In the case where window couldn't be found, then create a window
- // for that name / ID.
- //
- // Don't let the window literally be named "-1", because that's silly. Same with "new"
- const bool nameIsReserved = window == L"-1" || window == L"new";
- auto request = winrt::make_self(nameIsReserved ? L"" : window,
- content,
- windowBounds);
- RequestNewWindow.raise(*this, *request);
- }
- }
-
- // Very similar to the above. Someone came and told us that they were the target of a drag/drop, and they know who started it.
- // We will go tell the person who started it that they should send that target the content which was dragged.
- void Monarch::RequestSendContent(const Remoting::RequestReceiveContentArgs& args)
- {
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SendContent_Requested",
- TraceLoggingUInt64(args.SourceWindow(), "source", "The window which started the drag"),
- TraceLoggingUInt64(args.TargetWindow(), "target", "The window which was the target of the drop"),
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
-
- if (auto senderPeasant{ _getPeasant(args.SourceWindow()) })
- {
- senderPeasant.SendContent(args);
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SendContent_Completed",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- else
- {
- // We couldn't find the peasant that started the drag. Well that
- // sure is weird, but that would indicate that the sender closed
- // after starting the drag. No matter. We can just do nothing.
-
- TraceLoggingWrite(g_hRemotingProvider,
- "Monarch_SendContent_NoWindow",
- TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
- TraceLoggingKeyword(TIL_KEYWORD_TRACE));
- }
- }
-}
diff --git a/src/cascadia/Remoting/Monarch.h b/src/cascadia/Remoting/Monarch.h
deleted file mode 100644
index 4cc74d0c5bd..00000000000
--- a/src/cascadia/Remoting/Monarch.h
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-
-#pragma once
-
-#include "Monarch.g.h"
-#include "Peasant.h"
-#include "WindowActivatedArgs.h"
-#include "WindowRequestedArgs.g.h"
-#include
-
-// We sure different GUIDs here depending on whether we're running a Release,
-// Preview, or Dev build. This ensures that different installs don't
-// accidentally talk to one another.
-//
-// * Release: {06171993-7eb1-4f3e-85f5-8bdd7386cce3}
-// * Preview: {04221993-7eb1-4f3e-85f5-8bdd7386cce3}
-// * Canary: {09222022-7eb1-4f3e-85f5-8bdd7386cce3}
-// * Dev: {08302020-7eb1-4f3e-85f5-8bdd7386cce3}
-constexpr GUID Monarch_clsid
-{
-#if defined(WT_BRANDING_RELEASE)
- 0x06171993,
-#elif defined(WT_BRANDING_PREVIEW)
- 0x04221993,
-#elif defined(WT_BRANDING_CANARY)
- 0x09222022,
-#else
- 0x08302020,
-#endif
- 0x7eb1,
- 0x4f3e,
- {
- 0x85, 0xf5, 0x8b, 0xdd, 0x73, 0x86, 0xcc, 0xe4
- }
-};
-
-namespace RemotingUnitTests
-{
- class RemotingTests;
-};
-
-namespace winrt::Microsoft::Terminal::Remoting::implementation
-{
- struct WindowRequestedArgs : public WindowRequestedArgsT
- {
- public:
- WindowRequestedArgs(const Remoting::ProposeCommandlineResult& windowInfo, const Remoting::CommandlineArgs& command) :
- _Id{ windowInfo.Id() ? windowInfo.Id().Value() : 0 }, // We'll use 0 as a sentinel, since no window will ever get to have that ID
- _WindowName{ windowInfo.WindowName() },
- _args{ command.Commandline() },
- _CurrentDirectory{ command.CurrentDirectory() },
- _ShowWindowCommand{ command.ShowWindowCommand() },
- _CurrentEnvironment{ command.CurrentEnvironment() } {};
-
- WindowRequestedArgs(const winrt::hstring& window, const winrt::hstring& content, const Windows::Foundation::IReference& bounds) :
- _Id{ 0u },
- _WindowName{ window },
- _args{},
- _CurrentDirectory{},
- _Content{ content },
- _InitialBounds{ bounds } {};
-
- void Commandline(const winrt::array_view& value) { _args = { value.begin(), value.end() }; };
- winrt::com_array Commandline() { return winrt::com_array{ _args.begin(), _args.end() }; }
-
- WINRT_PROPERTY(uint64_t, Id);
- WINRT_PROPERTY(winrt::hstring, WindowName);
- WINRT_PROPERTY(winrt::hstring, CurrentDirectory);
- WINRT_PROPERTY(winrt::hstring, Content);
- WINRT_PROPERTY(uint32_t, ShowWindowCommand, SW_NORMAL);
- WINRT_PROPERTY(winrt::hstring, CurrentEnvironment);
- WINRT_PROPERTY(Windows::Foundation::IReference, InitialBounds);
-
- private:
- winrt::com_array _args;
- };
-
- struct Monarch : public MonarchT
- {
- Monarch();
- Monarch(const uint64_t testPID);
- ~Monarch();
-
- uint64_t GetPID();
-
- uint64_t AddPeasant(winrt::Microsoft::Terminal::Remoting::IPeasant peasant);
- void SignalClose(const uint64_t peasantId);
- void QuitAll();
-
- uint64_t GetNumberOfPeasants();
-
- winrt::Microsoft::Terminal::Remoting::ProposeCommandlineResult ProposeCommandline(const winrt::Microsoft::Terminal::Remoting::CommandlineArgs& args);
- void HandleActivatePeasant(const winrt::Microsoft::Terminal::Remoting::WindowActivatedArgs& args);
- void SummonWindow(const Remoting::SummonWindowSelectionArgs& args);
-
- void SummonAllWindows();
- bool DoesQuakeWindowExist();
- Windows::Foundation::Collections::IVectorView GetPeasantInfos();
-
- void RequestMoveContent(winrt::hstring window, winrt::hstring content, uint32_t tabIndex, const Windows::Foundation::IReference& windowBounds);
- void RequestSendContent(const Remoting::RequestReceiveContentArgs& args);
-
- til::typed_event FindTargetWindowRequested;
- til::typed_event<> ShowNotificationIconRequested;
- til::typed_event<> HideNotificationIconRequested;
- til::typed_event<> WindowCreated;
- til::typed_event<> WindowClosed;
-
- til::typed_event RequestNewWindow;
-
- private:
- uint64_t _ourPID;
-
- std::atomic _nextPeasantID{ 1 };
- uint64_t _ourPeasantId{ 0 };
-
- // When we're quitting we do not care as much about handling some events that we know will be triggered
- std::atomic _quitting{ false };
-
- winrt::com_ptr _desktopManager{ nullptr };
-
- std::unordered_map _peasants;
- std::vector _mruPeasants;
- // These should not be locked at the same time to prevent deadlocks
- // unless they are both shared_locks.
- std::shared_mutex _peasantsMutex{};
- std::shared_mutex _mruPeasantsMutex{};
-
- winrt::Microsoft::Terminal::Remoting::IPeasant _getPeasant(uint64_t peasantID, bool clearMruPeasantOnFailure = true);
- uint64_t _getMostRecentPeasantID(bool limitToCurrentDesktop, const bool ignoreQuakeWindow);
- uint64_t _lookupPeasantIdForName(std::wstring_view name);
-
- void _peasantWindowActivated(const winrt::Windows::Foundation::IInspectable& sender,
- const winrt::Microsoft::Terminal::Remoting::WindowActivatedArgs& args);
- void _doHandleActivatePeasant(const winrt::com_ptr& args);
- void _clearOldMruEntries(const std::unordered_set& peasantIds);
-
- void _forAllPeasantsIgnoringTheDead(std::function callback,
- std::function errorCallback);
-
- void _identifyWindows(const winrt::Windows::Foundation::IInspectable& sender,
- const winrt::Windows::Foundation::IInspectable& args);
-
- void _renameRequested(const winrt::Windows::Foundation::IInspectable& sender,
- const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args);
-
- void _handleQuitAll(const winrt::Windows::Foundation::IInspectable& sender,
- const winrt::Windows::Foundation::IInspectable& args);
-
- // Method Description:
- // - Helper for doing something on each and every peasant.
- // - We'll try calling func on every peasant.
- // - If the return type of func is void, it will perform it for all peasants.
- // - If the return type is a boolean, we'll break out of the loop once func
- // returns false.
- // - If any single peasant is dead, then we'll call onError and then add it to a
- // list of peasants to clean up once the loop ends.
- // - NB: this (separately) takes unique locks on _peasantsMutex and
- // _mruPeasantsMutex.
- // Arguments:
- // - func: The function to call on each peasant
- // - onError: The function to call if a peasant is dead.
- // Return Value:
- // -
- template
- void _forEachPeasant(F&& func, T&& onError)
- {
- using Map = decltype(_peasants);
- using R = std::invoke_result_t;
- static constexpr auto IsVoid = std::is_void_v;
-
- std::unordered_set peasantsToErase;
- {
- std::shared_lock lock{ _peasantsMutex };
-
- for (const auto& [id, p] : _peasants)
- {
- try
- {
- if constexpr (IsVoid)
- {
- func(id, p);
- }
- else
- {
- if (!func(id, p))
- {
- break;
- }
- }
- }
- catch (const winrt::hresult_error& exception)
- {
- onError(id);
-
- if (exception.code() == 0x800706ba) // The RPC server is unavailable.
- {
- peasantsToErase.emplace(id);
- }
- else
- {
- LOG_CAUGHT_EXCEPTION();
- throw;
- }
- }
- }
- }
-
- if (peasantsToErase.size() > 0)
- {
- // Don't hold a lock on _peasants and _mruPeasants at the same
- // time to avoid deadlocks.
- {
- std::unique_lock lock{ _peasantsMutex };
- for (const auto& id : peasantsToErase)
- {
- _peasants.erase(id);
- }
- }
- _clearOldMruEntries(peasantsToErase);
-
- // A peasant died, let the app host know that the number of
- // windows has changed.
- WindowClosed.raise(nullptr, nullptr);
- }
- }
-
- friend class RemotingUnitTests::RemotingTests;
- };
-}
-
-namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
-{
- BASIC_FACTORY(Monarch);
- BASIC_FACTORY(WindowRequestedArgs);
-}
diff --git a/src/cascadia/Remoting/Monarch.idl b/src/cascadia/Remoting/Monarch.idl
deleted file mode 100644
index ba00cf47cfe..00000000000
--- a/src/cascadia/Remoting/Monarch.idl
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-
-import "Peasant.idl";
-
-namespace Microsoft.Terminal.Remoting
-{
-
- [default_interface] runtimeclass FindTargetWindowArgs {
- CommandlineArgs Args { get; };
- Int32 ResultTargetWindow;
- String ResultTargetWindowName;
- }
-
- [default_interface] runtimeclass ProposeCommandlineResult {
- Windows.Foundation.IReference Id { get; };
- String WindowName { get; };
- Boolean ShouldCreateWindow { get; }; // If you name this `CreateWindow`, the compiler will explode
- }
-
- [default_interface] runtimeclass WindowRequestedArgs {
- WindowRequestedArgs(ProposeCommandlineResult windowInfo, CommandlineArgs command);
-
- UInt64 Id { get; };
- String WindowName { get; };
-
- String[] Commandline { get; };
- String CurrentDirectory { get; };
- UInt32 ShowWindowCommand { get; };
- String CurrentEnvironment { get; };
-
- String Content { get; };
- Windows.Foundation.IReference InitialBounds { get; };
- }
-
- [default_interface] runtimeclass SummonWindowSelectionArgs {
- SummonWindowSelectionArgs();
- SummonWindowSelectionArgs(String windowName);
- String WindowName;
- Boolean OnCurrentDesktop;
- // TODO GH#8888 Other options:
- // * CurrentMonitor
-
- Boolean FoundMatch;
- SummonWindowBehavior SummonBehavior;
- Windows.Foundation.IReference WindowID;
- }
-
- struct PeasantInfo
- {
- UInt64 Id;
- String Name;
- String TabTitle;
- };
-
- interface IMonarch
- {
-
- UInt64 GetPID();
- UInt64 AddPeasant(IPeasant peasant);
- UInt64 GetNumberOfPeasants();
- ProposeCommandlineResult ProposeCommandline(CommandlineArgs args);
- void HandleActivatePeasant(WindowActivatedArgs args);
- void SummonWindow(SummonWindowSelectionArgs args);
- void SignalClose(UInt64 peasantId);
- void QuitAll();
-
- void SummonAllWindows();
- Boolean DoesQuakeWindowExist();
- Windows.Foundation.Collections.IVectorView GetPeasantInfos { get; };
-
- void RequestMoveContent(String window, String content, UInt32 tabIndex, Windows.Foundation.IReference bounds);
- void RequestSendContent(RequestReceiveContentArgs args);
-
- event Windows.Foundation.TypedEventHandler