[PR #12938] Add support for running the terminal core as a content process #29315

Open
opened 2026-01-31 09:34:11 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/12938

State: closed
Merged: No


Summary of the Pull Request

This is 1000% WIP work. This PR, however, can go in now before the rest of tear out is ready. It's gated behind a new velocity flag that only enables it for Dev builds. Terminal the app also provides no way to leverage this quite yet, but it is hooked up for the sample app.

Adds an undocumented --content parameter to wt which allows you to pass a content GUID on the commandline. When you do that, wt will start up as a content process, instead of as a window process. WT will serve a singular terminal control instance, which can be accessed with

winrt::create_instance<winrt::Microsoft::Terminal::Control::ContentProcess>(contentGuid, CLSCTX_LOCAL_SERVER);

This content process will hang around until the last outstanding reference to it is closed.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Multiple different clients can access the same content process by simply communicating the GUID. That's obviously not recommended to do simultaneously, cause you'd have to keep the controls exactly the same size, but it's something that's possible.

Theoretically, we need to gate access to _interactivity and to _core behind some sort of safer accessor that won't just throw when the content process has died unexpectedly. A prototype was started in dev/migrie/oop/2/cptn-marvel, but that can definitely wait. Best to get this section of the merge conflicts done with now.

  • We've added a Control.ContentProcess class, which is responsible for owning a single ControlInteractivity bound to a GUID. You can use ContentProcess.RequestSwapChainHandle to get the swapchain of that content process.
    • this includes the TermControlContentManagement.cpp, which handles the TermControl side of connecting to one of these.
  • We've had to re-wire some InteractivityAutomationPeer methods, because we couldn't have a XAML AutomationPeer in the content process without XAML. I've checked that this still works in narrator and accessibility insights.
  • There's another file in WindowsTerminal for ContentProcessMain, for handling all the weird lifetime semantics of the content process.

Validation Steps Performed

It works pretty cool in the scratch sln.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/12938 **State:** closed **Merged:** No --- ## Summary of the Pull Request This is 1000% WIP work. This PR, however, can go in now before the rest of tear out is ready. It's gated behind a new velocity flag that only enables it for Dev builds. Terminal the app also provides no way to leverage this quite yet, but it is hooked up for the sample app. Adds an undocumented `--content` parameter to `wt` which allows you to pass a content GUID on the commandline. When you do that, `wt` will start up as a **content process**, instead of as a **window process**. WT will serve a singular terminal control instance, which can be accessed with ```c++ winrt::create_instance<winrt::Microsoft::Terminal::Control::ContentProcess>(contentGuid, CLSCTX_LOCAL_SERVER); ``` This content process will hang around until the last outstanding reference to it is closed. ## PR Checklist * [x] See #5000 * [x] I work here * [ ] Tests - probably should, yea. * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments Multiple different clients can access the same content process by simply communicating the GUID. That's obviously not recommended to do simultaneously, cause you'd have to keep the controls exactly the same size, but it's something that's possible. Theoretically, we need to gate access to `_interactivity` and to `_core` behind some sort of safer accessor that won't just throw when the content process has died unexpectedly. A prototype was started in `dev/migrie/oop/2/cptn-marvel`, but that can definitely wait. Best to get this section of the merge conflicts done with now. * We've added a `Control.ContentProcess` class, which is responsible for owning a single `ControlInteractivity` bound to a GUID. You can use `ContentProcess.RequestSwapChainHandle` to get the swapchain of that content process. - this includes the `TermControlContentManagement.cpp`, which handles the `TermControl` side of connecting to one of these. * We've had to re-wire some `InteractivityAutomationPeer` methods, because we couldn't have a XAML `AutomationPeer` in the content process _without XAML_. I've checked that this still works in narrator and accessibility insights. * There's another file in `WindowsTerminal` for `ContentProcessMain`, for handling all the weird lifetime semantics of the content process. ## Validation Steps Performed It works pretty cool in the scratch sln.
claunia added the pull-request label 2026-01-31 09:34:11 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29315