Skip to content

Fix opacity restore for command palette previews#12229

Merged
1 commit merged intomainfrom
dev/lhecker/fix-opacity-restore
Jan 24, 2022
Merged

Fix opacity restore for command palette previews#12229
1 commit merged intomainfrom
dev/lhecker/fix-opacity-restore

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented Jan 24, 2022

This commit correctly restores the previous opacity when the command palette
preview is cancelled. It includes an additional change in order to make the
AdjustOpacity setter consistent and symmetric with the Opacity getter.

PR Checklist

Validation Steps Performed

  • Open Windows Terminal command palette
  • Choose "Set background opacity..."
  • Cycle through the items without selecting one
  • Press Escape
  • Previous opacity is restored ✅

@lhecker lhecker requested a review from zadjii-msft January 24, 2022 02:32
@ghost ghost added Area-CmdPal Command Palette issues and features Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. labels Jan 24, 2022
}

void ControlCore::AdjustOpacity(const int32_t& opacity, const bool& relative)
void ControlCore::AdjustOpacity(const double opacityAdjust, const bool relative)
Copy link
Member Author

Choose a reason for hiding this comment

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

I wrote the reason for this in the commit description:

It includes an additional change in order to make the AdjustOpacity setter consistent and symmetric with the Opacity getter.

Let me know what you all think. 🙂

Comment on lines +73 to +75
const auto cleanup = wil::scope_exit([this]() {
_restorePreviewFuncs.clear();
});
Copy link
Member Author

Choose a reason for hiding this comment

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

Just in case a f() call below fails. This ensures the correct behavior for

const auto backup = _restorePreviewFuncs.empty();

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Ah okay. So only the first preview action now emplaces the revert. That makes enough sense I suppose.

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Jan 24, 2022
@DHowett
Copy link
Member

DHowett commented Jan 24, 2022

@msftbot merge this in 10 minutes

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 24, 2022
@ghost
Copy link

ghost commented Jan 24, 2022

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Mon, 24 Jan 2022 18:07:58 GMT, which is in 10 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@ghost ghost merged commit 5258fea into main Jan 24, 2022
@ghost ghost deleted the dev/lhecker/fix-opacity-restore branch January 24, 2022 18:08
zadjii-msft added a commit that referenced this pull request Jan 25, 2022
More fallout from the settings refactor. Probably because testing on a Windows
10 device is hard, because you actually need a physical machine to get acrylic
to behave correctly.

Basically, the code is simpler now, but we missed the windows 10 only edge case
where acrylic can get turned on, but we forget to enable the acrylic brush, so
it just stays off.

Refer to #11619 where this regressed, and #11643, #12229, because this is just a
hard problem apparently

* [x] Closes #11743. Technically OP is complaining about behavior that's
  by-design, but it made me realize this regressed in 1.12.
* [ ] No tests on this part of the TermControl unfortunately.
* [x] Hauled out my old Win10 laptop to verify that opacity works right:
  - [x] A fresh profile isn't created with any opacity
  - [x] Mouse wheeling turns on acrylic
  - [x] Using `opacity` only in the settings still stealthily enables acrylic
zadjii-msft added a commit that referenced this pull request Jan 25, 2022
More fallout from the settings refactor. Probably because testing on a Windows
10 device is hard, because you actually need a physical machine to get acrylic
to behave correctly.

Basically, the code is simpler now, but we missed the windows 10 only edge case
where acrylic can get turned on, but we forget to enable the acrylic brush, so
it just stays off.

Refer to #11619 where this regressed, and #11643, #12229, because this is just a
hard problem apparently

* [x] Closes #11743. Technically OP is complaining about behavior that's
  by-design, but it made me realize this regressed in 1.12.
* [ ] No tests on this part of the TermControl unfortunately.
* [x] Hauled out my old Win10 laptop to verify that opacity works right:
  - [x] A fresh profile isn't created with any opacity
  - [x] Mouse wheeling turns on acrylic
  - [x] Using `opacity` only in the settings still stealthily enables acrylic
ghost pushed a commit that referenced this pull request Jan 26, 2022
More fallout from the settings refactor. Probably because testing on a Windows
10 device is hard, because you actually need a physical machine to get acrylic
to behave correctly.

Basically, the code is simpler now, but we missed the windows 10 only edge case
where acrylic can get turned on, but we forget to enable the acrylic brush, so
it just stays off.

Refer to #11619 where this regressed, and #11643, #12229, because this is just a
hard problem apparently

* [x] Closes #11743. Technically OP is complaining about behavior that's
  by-design, but it made me realize this regressed in 1.12.
* [ ] No tests on this part of the `TermControl` unfortunately.
* [x] Hauled out my old Win10 laptop to verify that opacity works right:
  - [x] A fresh profile isn't created with any opacity
  - [x] Mouse wheeling turns on acrylic
  - [x] Using `opacity` only in the settings still stealthily enables acrylic
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-CmdPal Command Palette issues and features AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Priority-1 A description (P1) Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opacity is not correctly restored when cancelling the command palette preview

3 participants