[PR #14851] [MERGED] Introduce a ContentManager helper #30273

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14851
Author: @zadjii-msft
Created: 2/14/2023
Status: Merged
Merged: 3/22/2023
Merged by: @DHowett

Base: mainHead: dev/migrie/oop/3/valaquenta


📝 Commits (10+)

  • 581acd4 I definitely want all of this. But I started down a path for refactoring AppLogic that I hate so I'm gonna start over
  • a5255ba I don't think I want any of these
  • e6220b7 Revert "I don't think I want any of these"
  • 936c01f Start splitting AppLogic into AppLogic and Window logic
  • 439b21f this is dangerously close to compiling
  • 99bc280 It doesn't crash on launch. That's something. There's no startupActions though, so it immediately exits
  • 2195515 it launches
  • 5116ca1 I think the todo's that are left, we can move on without them for now.
  • ef7e2ed Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale
  • af14c2b [TO PARENT] Move the page ctor call, so that it can happen after the XAML island is started.

📊 Changes

21 files changed (+297 additions, -46 deletions)

View changed files

📝 src/cascadia/LocalTests_TerminalApp/TabTests.cpp (+11 -4)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+6 -1)
📝 src/cascadia/TerminalApp/AppLogic.h (+5 -0)
📝 src/cascadia/TerminalApp/AppLogic.idl (+2 -0)
src/cascadia/TerminalApp/ContentManager.cpp (+51 -0)
src/cascadia/TerminalApp/ContentManager.h (+44 -0)
📝 src/cascadia/TerminalApp/TerminalAppLib.vcxproj (+6 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+6 -2)
📝 src/cascadia/TerminalApp/TerminalPage.h (+3 -2)
📝 src/cascadia/TerminalApp/TerminalPage.idl (+8 -1)
📝 src/cascadia/TerminalApp/TerminalWindow.cpp (+4 -2)
📝 src/cascadia/TerminalApp/TerminalWindow.h (+3 -1)
📝 src/cascadia/TerminalApp/TerminalWindow.idl (+1 -1)
📝 src/cascadia/TerminalControl/ControlCore.idl (+0 -1)
📝 src/cascadia/TerminalControl/ControlInteractivity.cpp (+18 -0)
📝 src/cascadia/TerminalControl/ControlInteractivity.h (+9 -0)
📝 src/cascadia/TerminalControl/ControlInteractivity.idl (+6 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+47 -22)
📝 src/cascadia/TerminalControl/TermControl.h (+43 -9)
📝 src/cascadia/TerminalControl/TermControl.idl (+3 -0)

...and 1 more files

📄 Description

Summary

Thus we come to the introduction of a new servant, the ContentManager, a singular entity that serves at the behest of the emperor. It is its charge to keep track of all TermControl instances created by the windows, for each window must seek its blessing before calling forth such an instance.
With the aid of the ContentManager, the TermControl shall now be traced by the hand of fate through the use of unique identifying marks, known as GUIDs. Yet, its purpose remains yet unknown, for it is merely a waypoint upon the journey yet to come.
This act of bridging also brings a change to the handling of events within the TermControl. This change shall see the addition of a revoker, similar to the manner in which the AppHost hath employed it, to the TermControl. Additionally, there is a new layer of indirection between the ControlCore and the App layer, making ready for the day when the TermControl may be repositioned and re-parented with ease.
Consider this but a trivial act, a mere shadow of things yet to come, for its impact shall be felt but briefly, like the passing of a gentle breeze.

Related to #5000
Related to #1256

Detailed description

This PR is another small bridge PR between the big work in #14843, and the PR that will enable panes to move between windows.

This introduces a new class, called ContentManager. This is a global singleton object, owned by the emperor. Whenever a window wants to instantiate a new TermControl, it must ask the ContentManager to give it one. This allows the ContentManager to track each "content" by GUID. That's it. We don't do anything with them in this PR by itself, we just track them.

This also includes a small change to the way TermControl events are handled. It adds an AppHost-like revoker struct, and weak_ref's all the handlers. We also add a layer of indirection between the ControlCore's raising of events and the App layer's handling. This will make reparenting content easier in the future.

This is a pretty trivial change which shouldn't have any major side effects. Consider it exposition of the things to come. It's intentionally small to try and keep the reviews more managable.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14851 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/14/2023 **Status:** ✅ Merged **Merged:** 3/22/2023 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/migrie/oop/3/valaquenta` --- ### 📝 Commits (10+) - [`581acd4`](https://github.com/microsoft/terminal/commit/581acd40d9a5f7bcefdbaf29516bf418207be727) I definitely want all of this. But I started down a path for refactoring AppLogic that I hate so I'm gonna start over - [`a5255ba`](https://github.com/microsoft/terminal/commit/a5255ba8ed4cce537d3ac32b875a5a1516d4f4cb) I don't think I want any of these - [`e6220b7`](https://github.com/microsoft/terminal/commit/e6220b7fe7fbe293a2a1f99357d0973f2dde4f95) Revert "I don't think I want any of these" - [`936c01f`](https://github.com/microsoft/terminal/commit/936c01f948ac58d1a520dc7fbced8bb6d25c36b6) Start splitting AppLogic into AppLogic and Window logic - [`439b21f`](https://github.com/microsoft/terminal/commit/439b21f879be488b0ebc8e3901da6b3dd568bb99) this is dangerously close to compiling - [`99bc280`](https://github.com/microsoft/terminal/commit/99bc2802076ec7fa833bb77ef4a2c3997d93e52b) It doesn't crash on launch. That's something. There's no startupActions though, so it immediately exits - [`2195515`](https://github.com/microsoft/terminal/commit/219551593724eb1d822bc957c8497295d1b4fe5d) it launches - [`5116ca1`](https://github.com/microsoft/terminal/commit/5116ca1e77ed7ed75ab51ab58e803aa211ef850f) I think the todo's that are left, we can move on without them for now. - [`ef7e2ed`](https://github.com/microsoft/terminal/commit/ef7e2edfa5ee8f9cfda8f980cd540d89c1a552ef) Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale - [`af14c2b`](https://github.com/microsoft/terminal/commit/af14c2b75100ade347eda75582499d9caa460c2c) [TO PARENT] Move the page ctor call, so that it can happen after the XAML island is started. ### 📊 Changes **21 files changed** (+297 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_TerminalApp/TabTests.cpp` (+11 -4) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+6 -1) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+5 -0) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+2 -0) ➕ `src/cascadia/TerminalApp/ContentManager.cpp` (+51 -0) ➕ `src/cascadia/TerminalApp/ContentManager.h` (+44 -0) 📝 `src/cascadia/TerminalApp/TerminalAppLib.vcxproj` (+6 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+6 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+3 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.idl` (+8 -1) 📝 `src/cascadia/TerminalApp/TerminalWindow.cpp` (+4 -2) 📝 `src/cascadia/TerminalApp/TerminalWindow.h` (+3 -1) 📝 `src/cascadia/TerminalApp/TerminalWindow.idl` (+1 -1) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+0 -1) 📝 `src/cascadia/TerminalControl/ControlInteractivity.cpp` (+18 -0) 📝 `src/cascadia/TerminalControl/ControlInteractivity.h` (+9 -0) 📝 `src/cascadia/TerminalControl/ControlInteractivity.idl` (+6 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+47 -22) 📝 `src/cascadia/TerminalControl/TermControl.h` (+43 -9) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+3 -0) _...and 1 more files_ </details> ### 📄 Description ## Summary _Thus we come to the introduction of a new servant, the `ContentManager`, a singular entity that serves at the behest of the `emperor`. It is its charge to keep track of all `TermControl` instances created by the windows, for each window must seek its blessing before calling forth such an instance._ _With the aid of the `ContentManager`, the `TermControl` shall now be traced by the hand of fate through the use of unique identifying marks, known as `GUID`s. Yet, its purpose remains yet unknown, for it is merely a waypoint upon the journey yet to come._ _This act of bridging also brings a change to the handling of events within the `TermControl`. This change shall see the addition of a revoker, similar to the manner in which the `AppHost` hath employed it, to the `TermControl`. Additionally, there is a new layer of indirection between the `ControlCore` and the `App` layer, making ready for the day when the `TermControl` may be repositioned and re-parented with ease._ _Consider this but a trivial act, a mere shadow of things yet to come, for its impact shall be felt but briefly, like the passing of a gentle breeze._ Related to #5000 Related to #1256 # Detailed description This PR is another small bridge PR between the big work in #14843, and the PR that will enable panes to move between windows. This introduces a new class, called `ContentManager`. This is a global singleton object, owned by the emperor. Whenever a window wants to instantiate a new `TermControl`, it must ask the ContentManager to give it one. This allows the ContentManager to track each "content" by GUID. That's it. We don't do anything with them in this PR by itself, we just track them. This also includes a small change to the way TermControl events are handled. It adds an `AppHost`-like revoker struct, and weak_ref's all the handlers. We also add a layer of indirection between the ControlCore's raising of events and the App layer's handling. This will make reparenting content easier in the future. This is a pretty trivial change which shouldn't have any major side effects. Consider it exposition of the things to come. It's intentionally small to try and keep the reviews more managable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:39:43 +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#30273