[PR #7887] 7571: do not activate terminal window upon settings modificaion #27019

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

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

State: closed
Merged: Yes


Summary of the Pull Request

Took this as an easy starter. The method IslandWindow::SetAlwaysOnTop is triggered once terminal settings are reloaded (in TerminalPage::_RefreshUIForSettingsReload flow). This method calls SetWindowPos without SWP_NOACTIVATE. As a result the window gets activated, the focus is set and the cursor starts blinking.

Added SWP_NOACTIVATE flag there and in few additional places in island windows. See a discussion below.

References

PR Checklist

  • Closes https://github.com/microsoft/terminal/issues/7571
  • CLA signed.
  • Tests added/passed
  • Documentation updated - irrelevant
  • Schema updated - irrelevant
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Added SWP_NOACTIVATE in all SetWindowPos calls from IslandWindow and NoClientIslandWindow (where it was missing). Please let me know if this is an overkill - it is not required to fix the issue, however seems a good practice, that might help if we decide to apply more settings immediately.

Validation Steps Performed

  • Only manual testing - please guide me to the relevant UT framework, if exists.
  • Trying to reproduce this with VS attached doesn't work - the window gets the focus in any case.
  • Tested as a standalone application, by modifying different settings (and comparing the results before and after the fix).
  • Checked with Spy++ that no WM_ACTIVATE / WM_SETFOCUS is thrown upon settings modification
  • Applied terminal resizing, toggling full screen and focus mode to check no regression was introduced.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/7887 **State:** closed **Merged:** Yes --- <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Took this as an easy starter. The method IslandWindow::SetAlwaysOnTop is triggered once terminal settings are reloaded (in TerminalPage::_RefreshUIForSettingsReload flow). This method calls SetWindowPos without SWP_NOACTIVATE. As a result the window gets activated, the focus is set and the cursor starts blinking. Added SWP_NOACTIVATE flag there and in few additional places in island windows. See a discussion below. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [X] Closes https://github.com/microsoft/terminal/issues/7571 * [X] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated - irrelevant * [ ] Schema updated - irrelevant * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments Added SWP_NOACTIVATE in all SetWindowPos calls from IslandWindow and NoClientIslandWindow (where it was missing). Please let me know if this is an overkill - it is not required to fix the issue, however seems a good practice, that might help if we decide to apply more settings immediately. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed * Only manual testing - please guide me to the relevant UT framework, if exists. * Trying to reproduce this with VS attached doesn't work - the window gets the focus in any case. * Tested as a standalone application, by modifying different settings (and comparing the results before and after the fix). * Checked with Spy++ that no WM_ACTIVATE / WM_SETFOCUS is thrown upon settings modification * Applied terminal resizing, toggling full screen and focus mode to check no regression was introduced.
claunia added the pull-request label 2026-01-31 09:19:31 +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#27019