[PR #12900] Plumb Focus events through VT Input #29293

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

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

State: closed
Merged: Yes


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.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/12900 **State:** closed **Merged:** Yes --- 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.
claunia added the pull-request label 2026-01-31 09:34:03 +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#29293