Repository: microsoft/terminal (language: cpp)

Issue:
Ctrl+Shift+Scrollwheel can no longer fully disable transparency when using Acrylic
### Windows Terminal version

1.12.10733.0

### Windows build number

10.0.22000.593

### Other Software

_No response_

### Steps to reproduce

"useAcrylic": true
"opacity": 100 / "acrylicOpacity": 1.0


### Expected Behavior

Terminal window with fully opaque, solid color background

### Actual Behavior

![image](https://user-images.githubusercontent.com/17904156/162637785-4622852d-0881-4d03-bd50-6e0abd756358.png)

Terminal window still presents minor Acrylic effect, 
thus making switch between Acrylic% and Opaque with C+S+Wheel impossible.


Discussion / hints:
we discussed this some weeks back but never noted it down: I did this intentionally so people could have fully opaque acrylic. Turns out though, no one really likes that, and wants 100% opacity to always mean "acrylic off". That's fine by me. We just need to revert that bit of logic.
> We just need to revert that bit of logic.

Would that be easy enough to include in the next release?

Fix patch:
diff --git a/src/cascadia/TerminalControl/ControlCore.cpp b/src/cascadia/TerminalControl/ControlCore.cpp
index 7fa53304299..78d6c33ecc3 100644
--- a/src/cascadia/TerminalControl/ControlCore.cpp
+++ b/src/cascadia/TerminalControl/ControlCore.cpp
@@ -576,7 +576,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
         }
 
         // Update our runtime opacity value
-        Opacity(newOpacity);
+        _runtimeOpacity = newOpacity;
 
         // GH#11285 - If the user is on Windows 10, and they changed the
         // transparency of the control s.t. it should be partially opaque, then
@@ -584,10 +584,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
         // Windows 10.
         // We'll also turn the acrylic back off when they're fully opaque, which
         // is what the Terminal did prior to 1.12.
-        if (!IsVintageOpacityAvailable())
-        {
-            _runtimeUseAcrylic = newOpacity < 1.0;
-        }
+        _runtimeUseAcrylic = newOpacity < 1.0 && (!IsVintageOpacityAvailable() || _settings->UseAcrylic());
 
         // Update the renderer as well. It might need to fall back from
         // cleartype -> grayscale if the BG is transparent / acrylic.
@@ -711,16 +708,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
 
         auto lock = _terminal->LockForWriting();
 
-        _runtimeOpacity = std::nullopt;
-        _runtimeUseAcrylic = std::nullopt;
-
         // GH#11285 - If the user is on Windows 10, and they wanted opacity, but
         // didn't explicitly request acrylic, then opt them in to acrylic.
         // On Windows 11+, this isn't needed, because we can have vintage opacity.
-        if (!IsVintageOpacityAvailable() && _settings->Opacity() < 1.0 && !_settings->UseAcrylic())
-        {
-            _runtimeUseAcrylic = true;
-        }
+        // Instead, disable acrylic while the opacity is 100%
+        _runtimeUseAcrylic = _settings->Opacity() < 1.0 && (!IsVintageOpacityAvailable() || _settings->UseAcrylic());
+        _runtimeOpacity = std::nullopt;
 
         const auto sizeChanged = _setFontSizeUnderLock(_settings->FontSize());
 
@@ -1972,13 +1965,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
     {
         // If we're:
         // * Not fully opaque
-        // * On an acrylic background (of any opacity)
         // * rendering on top of an image
         //
         // then the renderer should not render "default background" text with a
         // fully opaque background. Doing that would cover up our nice
         // transparency, or our acrylic, or our image.
-        return Opacity() < 1.0f || UseAcrylic() || !_settings->BackgroundImage().empty() || _settings->UseBackgroundImageForWindow();
+        return Opacity() < 1.0f || !_settings->BackgroundImage().empty() || _settings->UseBackgroundImageForWindow();
     }
 
     uint64_t ControlCore::OwningHwnd()
diff --git a/src/cascadia/UnitTests_Control/ControlCoreTests.cpp b/src/cascadia/UnitTests_Control/ControlCoreTests.cpp
index e5a4772c6ac..658d4ca623c 100644
--- a/src/cascadia/UnitTests_Control/ControlCoreTests.cpp
+++ b/src/cascadia/UnitTests_Control/ControlCoreTests.cpp
@@ -141,8 +141,7 @@ namespace ControlUnitTests
             // GH#603: Adjusting opacity shouldn't change whether or not we
             // requested acrylic.
 
-            auto expectedUseAcrylic = winrt::Microsoft::Terminal::Control::implementation::ControlCore::IsVintageOpacityAvailable() ? true :
-                                                                                                                                      (expectedOpacity < 1.0 ? true : false);
+            auto expectedUseAcrylic = expectedOpacity < 1.0;
             VERIFY_ARE_EQUAL(expectedUseAcrylic, core->UseAcrylic());
             VERIFY_ARE_EQUAL(true, core->_settings->UseAcrylic());
         };
diff --git a/src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp b/src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp
index 1533614d12a..d73b7b122cc 100644
--- a/src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp
+++ b/src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp
@@ -144,8 +144,8 @@ namespace ControlUnitTests
             // The Settings object's opacity shouldn't be changed
             VERIFY_ARE_EQUAL(0.5, settings->Opacity());
 
-            auto expectedUseAcrylic = winrt::Microsoft::Terminal::Control::implementation::ControlCore::IsVintageOpacityAvailable() ? useAcrylic :
-                                                                                                                                      (expectedOpacity < 1.0 ? true : false);
+            auto expectedUseAcrylic = expectedOpacity < 1.0 &&
+                                      (!winrt::Microsoft::Terminal::Control::implementation::ControlCore::IsVintageOpacityAvailable() || useAcrylic);
             VERIFY_ARE_EQUAL(useAcrylic, settings->UseAcrylic());
             VERIFY_ARE_EQUAL(expectedUseAcrylic, core->UseAcrylic());
         };


Test patch: