[PR #12526] [MERGED] Enable the Terminal to tell ConPTY who the owner is #29085

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12526
Author: @zadjii-msft
Created: 2/18/2022
Status: Merged
Merged: 4/12/2022
Merged by: @DHowett

Base: mainHead: dev/migrie/f/z-order-owner


📝 Commits (10+)

  • 30863d2 working on prototypes. I'm not crazy. You're crazy
  • 555042e this is totally a hack but it worked better than expected
  • 31e9fef I think this plumbs all the way through. DPI is busted tho
  • cb2ad2b fixed the message pump
  • b257581 okay there's a way to get the terminal handle with this. I want to try with the actual terminal hwnd too
  • 2009147 a consistent way of getting the console or terminal hwnd? inconceivable!
  • 669b1e2 spell, fix test mock
  • 5d96691 thanks for nothing VS
  • e46e9a3 Merge remote-tracking branch 'origin/main' into dev/migrie/f/z-order-owner
  • 23b6fee this was a test that Evan wanted me to try. seemed to work okay, but it's not validated with WAM

📊 Changes

28 files changed (+259 additions, -15 deletions)

View changed files

📝 .github/actions/spelling/allow/apis.txt (+1 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+11 -0)
📝 src/cascadia/TerminalConnection/ConptyConnection.cpp (+23 -0)
📝 src/cascadia/TerminalConnection/ConptyConnection.h (+2 -0)
📝 src/cascadia/TerminalConnection/ConptyConnection.idl (+1 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+8 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+5 -0)
📝 src/cascadia/TerminalControl/ICoreState.idl (+3 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+10 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+3 -0)
📝 src/cascadia/WindowsTerminal/IslandWindow.cpp (+5 -0)
📝 src/cascadia/WindowsTerminal/IslandWindow.h (+1 -0)
📝 src/host/PtySignalInputThread.cpp (+46 -0)
📝 src/host/PtySignalInputThread.hpp (+9 -0)
📝 src/host/VtIo.cpp (+5 -0)
📝 src/host/outputStream.cpp (+14 -0)
📝 src/host/outputStream.hpp (+2 -0)
📝 src/inc/conpty-static.h (+2 -0)
📝 src/interactivity/base/InteractivityFactory.cpp (+33 -6)
📝 src/interactivity/base/InteractivityFactory.hpp (+1 -1)

...and 8 more files

📄 Description

Window shenanigans, part the first:

This PR enables terminals to tell ConPTY what the owning window for the pseudo window should be. This allows thigs like MessageBoxes created by console applications to work. It also enables console apps to use GetAncestor(GetConsoleWindow(), GA_ROOT) to get directly at the HWND of the Terminal (but don't please).

This is tested with our internal partners and seems to work for their scenario.

See #2988, #12799, #12515, #12570.

PR Checklist

  • This is 1/3 of #2988.
  • I work here

TODOS:

  • Clean up dead code, scratch, etc.
  • Especially make sure that the reparenting flow makes sense post-startup. (for tear-out, #5000. Won't be able to test now, but should work then)
  • Come up with a total list of scenarios where the z ordering is messed up
  • Sync with auth folks to see if this worked
  • merge with #12515 work
  • tests?

🔄 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/12526 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/18/2022 **Status:** ✅ Merged **Merged:** 4/12/2022 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/migrie/f/z-order-owner` --- ### 📝 Commits (10+) - [`30863d2`](https://github.com/microsoft/terminal/commit/30863d20604fc9496f0422b2e2ef9b5e7c98ad84) working on prototypes. I'm not crazy. You're crazy - [`555042e`](https://github.com/microsoft/terminal/commit/555042ebfe3bd42e106099f39e06fb385e228f51) this is totally a hack but it worked better than expected - [`31e9fef`](https://github.com/microsoft/terminal/commit/31e9fef447d39ad5e4f6ac44b4460a9ac895abf7) I think this plumbs all the way through. DPI is busted tho - [`cb2ad2b`](https://github.com/microsoft/terminal/commit/cb2ad2b2855393b94decaa6d8301ffda07d5fd26) fixed the message pump - [`b257581`](https://github.com/microsoft/terminal/commit/b2575819b459f369fb96d2f4a9683d340bf72c0a) okay there's a way to get the terminal handle with this. I want to try with the actual terminal hwnd too - [`2009147`](https://github.com/microsoft/terminal/commit/2009147c9df585b6e2b5076aacb0ef072aa0aab0) a consistent way of getting the console or terminal hwnd? inconceivable! - [`669b1e2`](https://github.com/microsoft/terminal/commit/669b1e2609c27575fb72d07e4eb1d2a55ebc4b36) spell, fix test mock - [`5d96691`](https://github.com/microsoft/terminal/commit/5d96691b01a07b0011791f120725fbc068ffdf3b) thanks for nothing VS - [`e46e9a3`](https://github.com/microsoft/terminal/commit/e46e9a38e188a4c9f5240e56f2c179c46bf8671f) Merge remote-tracking branch 'origin/main' into dev/migrie/f/z-order-owner - [`23b6fee`](https://github.com/microsoft/terminal/commit/23b6fee1f0b1722a9f081e52b8f47eea45a0f709) this was a test that Evan wanted me to try. seemed to work okay, but it's not validated with WAM ### 📊 Changes **28 files changed** (+259 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/apis.txt` (+1 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+11 -0) 📝 `src/cascadia/TerminalConnection/ConptyConnection.cpp` (+23 -0) 📝 `src/cascadia/TerminalConnection/ConptyConnection.h` (+2 -0) 📝 `src/cascadia/TerminalConnection/ConptyConnection.idl` (+1 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+8 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+5 -0) 📝 `src/cascadia/TerminalControl/ICoreState.idl` (+3 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+10 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+3 -0) 📝 `src/cascadia/WindowsTerminal/IslandWindow.cpp` (+5 -0) 📝 `src/cascadia/WindowsTerminal/IslandWindow.h` (+1 -0) 📝 `src/host/PtySignalInputThread.cpp` (+46 -0) 📝 `src/host/PtySignalInputThread.hpp` (+9 -0) 📝 `src/host/VtIo.cpp` (+5 -0) 📝 `src/host/outputStream.cpp` (+14 -0) 📝 `src/host/outputStream.hpp` (+2 -0) 📝 `src/inc/conpty-static.h` (+2 -0) 📝 `src/interactivity/base/InteractivityFactory.cpp` (+33 -6) 📝 `src/interactivity/base/InteractivityFactory.hpp` (+1 -1) _...and 8 more files_ </details> ### 📄 Description ## Window shenanigans, part the first: This PR enables terminals to tell ConPTY what the owning window for the pseudo window should be. This allows thigs like MessageBoxes created by console applications to work. It also enables console apps to use `GetAncestor(GetConsoleWindow(), GA_ROOT)` to get directly at the HWND of the Terminal (but _don't please_). This is tested with our internal partners and seems to work for their scenario. See #2988, #12799, #12515, #12570. ## PR Checklist * [x] This is 1/3 of #2988. * [x] I work here ### TODOS: * [x] Clean up dead code, scratch, etc. * [x] Especially make sure that the reparenting flow makes sense post-startup. (for tear-out, #5000. Won't be able to test now, but should work then) * [x] Come up with a total list of scenarios where the z ordering is messed up * [x] Sync with auth folks to see if this worked * [x] merge with #12515 work * [ ] tests? --- <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:32:40 +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#29085