[PR #12900] [MERGED] Plumb Focus events through VT Input #29288

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12900
Author: @zadjii-msft
Created: 4/13/2022
Status: ✅ Merged
Merged: 4/20/2022
Merged by: @undefined

Base: main ← Head: dev/migrie/f/11682-vt-focus-events


📝 Commits (10+)

  • 9dd1649 Doesn't build. Want to merge in the ConGetSet change first, cause obviously that's gonna blow this diff up.
  • 1a1caf9 cherry-pick 479c6c9f08
  • 5be7f76 comments comments comments
  • 37adb94 remove a todo
  • 172acd2 you knew there'd be typos
  • 0d17cd7 Merge branch 'main' into dev/migrie/b/2988-focus-foreground
  • 3e0c15a Merge branch 'dev/migrie/f/z-order-owner' into dev/migrie/b/2988-focus-foreground
  • 72e3ed4 check the ownership for FG rights. NOT TESTED
  • b1ab305 this makes ConPTY ask for focus events always, and plumbs them through huge parts of console and terminal
  • 473020b sure, why not hook it up to conhost too while I'm here

📊 Changes

18 files changed (+108 additions, -9 deletions)

View changed files

📝 src/cascadia/TerminalControl/ControlCore.cpp (+2 -2)
📝 src/cascadia/TerminalCore/ITerminalInput.hpp (+2 -0)
📝 src/cascadia/TerminalCore/Terminal.cpp (+13 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+2 -0)
📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+17 -1)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+1 -0)
📝 src/host/inputBuffer.cpp (+1 -0)
📝 src/renderer/vt/VtSequences.cpp (+5 -0)
📝 src/renderer/vt/state.cpp (+1 -0)
📝 src/renderer/vt/vtrenderer.hpp (+2 -0)
📝 src/terminal/adapter/DispatchTypes.hpp (+1 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+1 -0)
📝 src/terminal/adapter/InteractDispatch.cpp (+1 -4)
📝 src/terminal/adapter/adaptDispatch.cpp (+36 -2)
📝 src/terminal/adapter/adaptDispatch.hpp (+1 -0)
📝 src/terminal/adapter/termDispatch.hpp (+1 -0)
📝 src/terminal/input/terminalInput.cpp (+18 -0)
📝 src/terminal/input/terminalInput.hpp (+3 -0)

📄 Description

Further builds on #12799. #12799 assumes that the connection is prepared to receive FocusIn/FocusOut events as input. For ConPTY we can be relatively sure of that, but that's not technically correct. In the hypothetical world where the connection is not a ConPTY connection, then the other side might not be expecting those sequences.

This remedies the issue by

  • ConPTY will always request focus event mode (from the terminal) when it starts up
  • when a client tries to disable focus events in conpty, conpty is gonna note that internally, but never transmit that to the hosting terminal, to leave the terminal in focus event mode.
  • TerminalDispatch and ControlCore are hooked up now to only send focus events when the Terminal is in focus event mode (which will be always for conpty)
  • At this point, it was like, 4LOC in terminalInput.cpp to add support for focus events to conhost as well.

checklist

  • closes #11682
    • This combined with #12515 will finally close out #2988 as well, but we can do that manually.
  • I work here
  • There aren't tests for this. There probably should be.

🔄 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/12900 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/13/2022 **Status:** ✅ Merged **Merged:** 4/20/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/f/11682-vt-focus-events` --- ### 📝 Commits (10+) - [`9dd1649`](https://github.com/microsoft/terminal/commit/9dd16495251e393aa05387c955697ecc7efd64be) Doesn't build. Want to merge in the ConGetSet change first, cause _obviously_ that's gonna blow this diff up. - [`1a1caf9`](https://github.com/microsoft/terminal/commit/1a1caf94357e317ac0c5bc85fc8502e75f988644) cherry-pick 479c6c9f08cf273768e64f9f7fbc74a2c231b815 - [`5be7f76`](https://github.com/microsoft/terminal/commit/5be7f76586e2a9d7363145171383b00fe1a44f0f) comments comments comments - [`37adb94`](https://github.com/microsoft/terminal/commit/37adb94c90454d7b8f8c5ad6671b5edac34c8f39) remove a todo - [`172acd2`](https://github.com/microsoft/terminal/commit/172acd2f8b08ecca2d883de77dd2acdaf55bd48b) you knew there'd be typos - [`0d17cd7`](https://github.com/microsoft/terminal/commit/0d17cd722996bc291b0dc8ec41cd7fd335905a38) Merge branch 'main' into dev/migrie/b/2988-focus-foreground - [`3e0c15a`](https://github.com/microsoft/terminal/commit/3e0c15a75ecbea2f187e28e3a69cdcbb69c892c8) Merge branch 'dev/migrie/f/z-order-owner' into dev/migrie/b/2988-focus-foreground - [`72e3ed4`](https://github.com/microsoft/terminal/commit/72e3ed48093e2ffcd0985a9792cb47f5c619a105) check the ownership for FG rights. NOT TESTED - [`b1ab305`](https://github.com/microsoft/terminal/commit/b1ab3056ecbfb71e84c7d6666e583325ec5dd1bf) this makes ConPTY ask for focus events always, and plumbs them through huge parts of console and terminal - [`473020b`](https://github.com/microsoft/terminal/commit/473020b9706a34ccc249faf0cfbc60e60e6e22dd) sure, why not hook it up to conhost too while I'm here ### 📊 Changes **18 files changed** (+108 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+2 -2) 📝 `src/cascadia/TerminalCore/ITerminalInput.hpp` (+2 -0) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+13 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+2 -0) 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+17 -1) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+1 -0) 📝 `src/host/inputBuffer.cpp` (+1 -0) 📝 `src/renderer/vt/VtSequences.cpp` (+5 -0) 📝 `src/renderer/vt/state.cpp` (+1 -0) 📝 `src/renderer/vt/vtrenderer.hpp` (+2 -0) 📝 `src/terminal/adapter/DispatchTypes.hpp` (+1 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+1 -0) 📝 `src/terminal/adapter/InteractDispatch.cpp` (+1 -4) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+36 -2) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+1 -0) 📝 `src/terminal/adapter/termDispatch.hpp` (+1 -0) 📝 `src/terminal/input/terminalInput.cpp` (+18 -0) 📝 `src/terminal/input/terminalInput.hpp` (+3 -0) </details> ### 📄 Description Further builds on #12799. #12799 assumes that the connection is prepared to receive FocusIn/FocusOut events as input. For ConPTY we can be relatively sure of that, but that's not _technically_ correct. In the hypothetical world where the connection is not a ConPTY connection, then the other side might not be expecting those sequences. This remedies the issue by * ConPTY will always request focus event mode (from the terminal) when it starts up * when a client tries to disable focus events in conpty, conpty is gonna note that internally, but never transmit that to the hosting terminal, to leave the terminal in focus event mode. * `TerminalDispatch` and `ControlCore` are hooked up now to only send focus events when the Terminal is in focus event mode (which will be always for conpty) * At this point, it was like, 4LOC in `terminalInput.cpp` to add support for focus events to conhost as well. ## checklist * [x] closes #11682 * This combined with #12515 will finally close out #2988 as well, but we can do that manually. * [x] I work here * [ ] There aren't tests for this. There probably should be. --- <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:34:01 +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#29288