close
Skip to content

Add caption button dim out for unfocused windows#19668

Merged
DHowett merged 3 commits into
microsoft:mainfrom
Aliremu:dev/aliremu/12632
Jan 20, 2026
Merged

Add caption button dim out for unfocused windows#19668
DHowett merged 3 commits into
microsoft:mainfrom
Aliremu:dev/aliremu/12632

Conversation

@Aliremu

@Aliremu Aliremu commented Dec 21, 2025

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

This PR closes #12632 by dimming the caption controls in the titlebar when unfocused. Leaves them intact when in high contrast mode. The color used is borrowed from PowerToy's unfocused color: https://github.com/microsoft/PowerToys/blob/37bd24db365d7bfc3e27fc77d0ac3c0948ffa189/src/settings-ui/Settings.UI/SettingsXAML/Controls/TitleBar/TitleBar.xaml#L179

References and Relevant Issues

#12632
#10401

Detailed Description of the Pull Request / Additional comments

Introduces a _focused boolean to TitlebarControl which is passed into MinMaxCloseControl. Instead of using a new VisualStateGroup, I opted to slot the Unfocused state into CommonStates, this way we prevent any conflicts with Visual Setters, and can preserve animations.

Validation Steps Performed

Tested by hovering and unhovering in focused and unfocused states, as well as in high contrast mode. States are consistent and applied correctly. I did notice that clicking on the titlebar wouldn't put it into focus unless I also moved my mouse though, but that is also present in the release branch.

Closes #12632

@Aliremu

Aliremu commented Dec 21, 2025

Copy link
Copy Markdown
Contributor Author

@Aliremu please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Theming Anything related to the theming of elements of the window Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Dec 21, 2025
Comment thread src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp Fixed
@github-actions

This comment has been minimized.

@carlos-zamora carlos-zamora left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a quick glance, I'm personally not a fan of adding a _focused member to MinMaxCloseControl and TitlebarControl. The concern being that at some point these two may go out of sync (not necessarily in this PR, but in the future).

Since TitlebarControl doesn't really use _focused other than passing it down to MinMaxCloseControl, how about this:

  • remove _focused from TitlebarControl
  • when _titlebar.Focused() is called, instead set it on the MinMaxCloseControl (either replace the code directly or have TitlebarControl::Focused() just set it on the MinMaxCloseControl then)
  • then, you won't need to pass _focused each time you interact with the control. MinMaxCloseControl should then be keeping track of the state directly and make changes appropriately

That should end up reducing the complexity by a bit, and you'll actually use the MinMaxCloseControl::_focused member you added 😉.

Aside from that, I tested the changes locally and it looks/feels great! Thanks for doing this, I'm excited to see it land soon. 😊

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 12, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 18, 2026
@Aliremu

Aliremu commented Jan 18, 2026

Copy link
Copy Markdown
Contributor Author

From a quick glance, I'm personally not a fan of adding a _focused member to MinMaxCloseControl and TitlebarControl. The concern being that at some point these two may go out of sync (not necessarily in this PR, but in the future).

Since TitlebarControl doesn't really use _focused other than passing it down to MinMaxCloseControl, how about this:

  • remove _focused from TitlebarControl
  • when _titlebar.Focused() is called, instead set it on the MinMaxCloseControl (either replace the code directly or have TitlebarControl::Focused() just set it on the MinMaxCloseControl then)
  • then, you won't need to pass _focused each time you interact with the control. MinMaxCloseControl should then be keeping track of the state directly and make changes appropriately

That should end up reducing the complexity by a bit, and you'll actually use the MinMaxCloseControl::_focused member you added 😉.

Aside from that, I tested the changes locally and it looks/feels great! Thanks for doing this, I'm excited to see it land soon. 😊

Thanks! I've removed _focused from TitlebarControl and consolidated it into MinMaxCloseControl as its source of truth.

@Aliremu Aliremu requested a review from carlos-zamora January 20, 2026 19:22

@carlos-zamora carlos-zamora left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you! 😊

@carlos-zamora

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@carlos-zamora carlos-zamora enabled auto-merge (squash) January 20, 2026 19:43

@DHowett DHowett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this. :)

@DHowett DHowett disabled auto-merge January 20, 2026 20:03
@DHowett DHowett enabled auto-merge (squash) January 20, 2026 20:04
@DHowett DHowett merged commit 8d94edd into microsoft:main Jan 20, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this to To Cherry Pick in 1.24 Servicing Pipeline Jan 22, 2026
@github-project-automation github-project-automation Bot moved this to To Cherry Pick in 1.23 Servicing Pipeline Jan 22, 2026
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.23 Servicing Pipeline Jan 22, 2026
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.24 Servicing Pipeline Jan 22, 2026
DHowett pushed a commit that referenced this pull request Jan 22, 2026
This PR closes #12632 by dimming the caption controls in the titlebar
when unfocused. Leaves them intact when in high contrast mode. The color
used is borrowed from PowerToys' unfocused color.

## Validation Steps Performed
Tested by hovering and unhovering in focused and unfocused states, as
well as in high contrast mode. States are consistent and applied
correctly. I did notice that clicking on the titlebar wouldn't put it
into focus unless I also moved my mouse though, but that is also present
in the release branch.

Closes #12632

(cherry picked from commit 8d94edd)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkC_KM
Service-Version: 1.24
DHowett pushed a commit that referenced this pull request Jan 22, 2026
This PR closes #12632 by dimming the caption controls in the titlebar
when unfocused. Leaves them intact when in high contrast mode. The color
used is borrowed from PowerToys' unfocused color.

## Validation Steps Performed
Tested by hovering and unhovering in focused and unfocused states, as
well as in high contrast mode. States are consistent and applied
correctly. I did notice that clicking on the titlebar wouldn't put it
into focus unless I also moved my mouse though, but that is also present
in the release branch.

Closes #12632

(cherry picked from commit 8d94edd)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgkC_KQ
Service-Version: 1.23
@DHowett DHowett moved this from Cherry Picked to Shipped in 1.24 Servicing Pipeline Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Theming Anything related to the theming of elements of the window Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.

Projects

Status: Cherry Picked

Development

Successfully merging this pull request may close these issues.

Make sure caption controls "dim out" when window loses NC focus (WM_NCACTIVATE?)

4 participants