[PR #10051] [MERGED] Only access ControlInteractivity through the projection #27876

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10051
Author: @zadjii-msft
Created: 5/7/2021
Status: Merged
Merged: 7/19/2021
Merged by: @zadjii-msft

Base: mainHead: dev/migrie/interactivity-projection-000


📝 Commits (10+)

  • e4478ee Only access ControlInteractivity through the projection
  • 400b35f Only 24 more errors to go
  • 42b970b Totally upend the control AutomationPeer workings
  • 4578c13 some comments that should have been in the previous commit. 16 errors remain.
  • d8cc047 GetHoveredCell/UpdateHoveredCell. 12 remain.
  • 21a97b6 Revert "Revert "Use DComp surface handle for Swap Chain management.""
  • 2e861d8 some minor cleanup
  • e20caae Merge branch 'dev/migrie/f/oop/use-dcomp-handle' into dev/migrie/interactivity-projection-000
  • d667f3b Use the HANDLE for the swapchainin the core projection
  • 62cbf30 it builds and runs so I guess it's done now

📊 Changes

27 files changed (+968 additions, -349 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppLogic.cpp (+2 -2)
📝 src/cascadia/TerminalApp/AppLogic.h (+2 -2)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+4 -4)
📝 src/cascadia/TerminalApp/TerminalPage.h (+2 -2)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+44 -9)
📝 src/cascadia/TerminalControl/ControlCore.h (+12 -6)
📝 src/cascadia/TerminalControl/ControlCore.idl (+88 -0)
📝 src/cascadia/TerminalControl/ControlInteractivity.cpp (+82 -18)
📝 src/cascadia/TerminalControl/ControlInteractivity.h (+23 -15)
📝 src/cascadia/TerminalControl/ControlInteractivity.idl (+48 -0)
📝 src/cascadia/TerminalControl/ICoreState.idl (+1 -0)
src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp (+208 -0)
src/cascadia/TerminalControl/InteractivityAutomationPeer.h (+85 -0)
src/cascadia/TerminalControl/InteractivityAutomationPeer.idl (+18 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+166 -161)
📝 src/cascadia/TerminalControl/TermControl.h (+15 -17)
📝 src/cascadia/TerminalControl/TermControlAutomationPeer.cpp (+38 -79)
📝 src/cascadia/TerminalControl/TermControlAutomationPeer.h (+13 -17)
📝 src/cascadia/TerminalControl/TermControlAutomationPeer.idl (+3 -0)
📝 src/cascadia/TerminalControl/TerminalControlLib.vcxproj (+7 -0)

...and 7 more files

📄 Description

Summary of the Pull Request

This forces the TermControl to only use ControlCore and ControlInteractivity via their WinRT projections. We want this, because WinRT projections can be used across process boundaries. In the future, ControlCore and ControlInteractivity are going to be living in a different process entirely from TermControl. By enforcing this boundary now, we can make sure that they will work seamlessly in the future.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

Most all this was just converting pure c++ types to winrt types when possible. I've added a couple helper projections with til converters, which made most of this really easy.

The "MouseButtonState needs to be composed of Int32s instead of bools" is MENTAL. I have no idea why this is, but when I had the control OOP in the sample, that would crash when trying to de-marshal the bools. BODGY.

The biggest changes are in the way the UIA stuff is hooked up. The UiaEngine needs to be attached directly to the Renderer, and it can't be easily projected, so it needs to live next to the ControlCore. But the TermControlAutomationPeer needed the UiaEngine to help implement some interfaces.

Now, there's a new layer we've introduced. InteractivityAutomationPeer does the ITextProvider, IControlAccessibilityInfo and the IUiaEventDispatcher thing. TermControlAutomationPeer now has a
InteractivityAutomationPeer stashed inside itself, so that it can ask the interactivity layer to do the real work. We still need the TermControlAutomationPeer though, to be able to attach to the real UI tree.

Validation Steps Performed

The terminal behaves basically the same as before.

Most importantly, I whipped out Accessibility Insights, and the Terminal looks the same as before.


🔄 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/10051 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 5/7/2021 **Status:** ✅ Merged **Merged:** 7/19/2021 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/interactivity-projection-000` --- ### 📝 Commits (10+) - [`e4478ee`](https://github.com/microsoft/terminal/commit/e4478eec6afa26b0f9d401e80195b527471a1005) Only access ControlInteractivity through the projection - [`400b35f`](https://github.com/microsoft/terminal/commit/400b35f8140732aa8483f6a90c09ad225a93581c) Only 24 more errors to go - [`42b970b`](https://github.com/microsoft/terminal/commit/42b970b7f22248bb17dd295011ce6a5ff5a064cf) Totally upend the control AutomationPeer workings - [`4578c13`](https://github.com/microsoft/terminal/commit/4578c136a054a1efc50e99264a555547a909fda1) some comments that should have been in the previous commit. 16 errors remain. - [`d8cc047`](https://github.com/microsoft/terminal/commit/d8cc047a7ef39d93430bc724e8071e3568cd4dc6) GetHoveredCell/UpdateHoveredCell. 12 remain. - [`21a97b6`](https://github.com/microsoft/terminal/commit/21a97b6c80dd95cf3be84d9eb2070adc5956fa75) Revert "Revert "Use DComp surface handle for Swap Chain management."" - [`2e861d8`](https://github.com/microsoft/terminal/commit/2e861d8a37886278e638c556b71e44943d6b64b7) some minor cleanup - [`e20caae`](https://github.com/microsoft/terminal/commit/e20caae758319433196b4baa4cf6a06354801e05) Merge branch 'dev/migrie/f/oop/use-dcomp-handle' into dev/migrie/interactivity-projection-000 - [`d667f3b`](https://github.com/microsoft/terminal/commit/d667f3b63340b6db35a30e141c75bdecb6931ad0) Use the HANDLE for the swapchainin the core projection - [`62cbf30`](https://github.com/microsoft/terminal/commit/62cbf30782fd8439d755226c43ed7d366748aa94) it builds and runs so I guess it's done now ### 📊 Changes **27 files changed** (+968 additions, -349 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+2 -2) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+2 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+4 -4) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+2 -2) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+44 -9) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+12 -6) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+88 -0) 📝 `src/cascadia/TerminalControl/ControlInteractivity.cpp` (+82 -18) 📝 `src/cascadia/TerminalControl/ControlInteractivity.h` (+23 -15) 📝 `src/cascadia/TerminalControl/ControlInteractivity.idl` (+48 -0) 📝 `src/cascadia/TerminalControl/ICoreState.idl` (+1 -0) ➕ `src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp` (+208 -0) ➕ `src/cascadia/TerminalControl/InteractivityAutomationPeer.h` (+85 -0) ➕ `src/cascadia/TerminalControl/InteractivityAutomationPeer.idl` (+18 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+166 -161) 📝 `src/cascadia/TerminalControl/TermControl.h` (+15 -17) 📝 `src/cascadia/TerminalControl/TermControlAutomationPeer.cpp` (+38 -79) 📝 `src/cascadia/TerminalControl/TermControlAutomationPeer.h` (+13 -17) 📝 `src/cascadia/TerminalControl/TermControlAutomationPeer.idl` (+3 -0) 📝 `src/cascadia/TerminalControl/TerminalControlLib.vcxproj` (+7 -0) _...and 7 more files_ </details> ### 📄 Description ## Summary of the Pull Request This forces the `TermControl` to only use `ControlCore` and `ControlInteractivity` via their WinRT projections. We want this, because WinRT projections can be used across process boundaries. In the future, `ControlCore` and `ControlInteractivity` are going to be living in a different process entirely from `TermControl`. By enforcing this boundary now, we can make sure that they will work seamlessly in the future. ## References * Tear-out: #1256 * Megathread: #5000 * Project: https://github.com/microsoft/terminal/projects/5 ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/projects/5#card-50760270 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments Most all this was just converting pure c++ types to winrt types when possible. I've added a couple helper projections with `til` converters, which made most of this really easy. The "`MouseButtonState` needs to be composed of `Int32`s instead of `bool`s" is MENTAL. I have no idea why this is, but when I had the control OOP in the sample, that would crash when trying to de-marshal the bools. BODGY. The biggest changes are in the way the UIA stuff is hooked up. The UiaEngine needs to be attached directly to the `Renderer`, and it can't be easily projected, so it needs to live next to the `ControlCore`. But the `TermControlAutomationPeer` needed the `UiaEngine` to help implement some interfaces. Now, there's a new layer we've introduced. `InteractivityAutomationPeer` does the `ITextProvider`, `IControlAccessibilityInfo` and the `IUiaEventDispatcher` thing. `TermControlAutomationPeer` now has a `InteractivityAutomationPeer` stashed inside itself, so that it can ask the interactivity layer to do the real work. We still need the `TermControlAutomationPeer` though, to be able to attach to the real UI tree. ## Validation Steps Performed The terminal behaves basically the same as before. Most importantly, I whipped out Accessibility Insights, and the Terminal looks the same as before. --- <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:24:50 +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#27876