This is the start of fixing the opacity roundtripping weirdness
This commit is contained in:
parent
a9de82e4ee
commit
70b9f8ce5f
|
@ -441,8 +441,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
1.0);
|
1.0);
|
||||||
|
|
||||||
// GH#5098: Inform the engine of the new opacity of the default text background.
|
// GH#5098: Inform the engine of the new opacity of the default text background.
|
||||||
SetBackgroundOpacity(::base::saturated_cast<float>(newOpacity));
|
|
||||||
|
|
||||||
|
// TODO! This doesn't work when (aa:cleartype && useAcrylic:true &&
|
||||||
|
// opacity<1.0 -> 1.0) We end up forcing the solid BG, but the padding
|
||||||
|
// around the terminal is still acrylic. I think we only need to tell
|
||||||
|
// the engine to do the solid BG trick for useAcrylic:true, not for
|
||||||
|
// vintage opacity. Lets find out.
|
||||||
|
//
|
||||||
|
// SetBackgroundOpacity(newOpacity);
|
||||||
|
|
||||||
|
// Update our runtime opacity value
|
||||||
Opacity(newOpacity);
|
Opacity(newOpacity);
|
||||||
|
|
||||||
// GH#11285 - If the user is on Windows 10, and they changed the
|
// GH#11285 - If the user is on Windows 10, and they changed the
|
||||||
|
@ -580,6 +588,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
// - INVARIANT: This method can only be called if the caller DOES NOT HAVE writing lock on the terminal.
|
// - INVARIANT: This method can only be called if the caller DOES NOT HAVE writing lock on the terminal.
|
||||||
void ControlCore::UpdateSettings(const IControlSettings& settings, const IControlAppearance& newAppearance)
|
void ControlCore::UpdateSettings(const IControlSettings& settings, const IControlAppearance& newAppearance)
|
||||||
{
|
{
|
||||||
|
std::unique_lock l{ _settingsLock };
|
||||||
_settings = winrt::make_self<implementation::ControlSettings>(settings, newAppearance);
|
_settings = winrt::make_self<implementation::ControlSettings>(settings, newAppearance);
|
||||||
|
|
||||||
auto lock = _terminal->LockForWriting();
|
auto lock = _terminal->LockForWriting();
|
||||||
|
@ -620,6 +629,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
|
|
||||||
_renderEngine->SetForceFullRepaintRendering(_settings->ForceFullRepaintRendering());
|
_renderEngine->SetForceFullRepaintRendering(_settings->ForceFullRepaintRendering());
|
||||||
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
|
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
|
||||||
|
// Inform the renderer of our opacity
|
||||||
|
_renderEngine->SetDefaultTextBackgroundOpacity(::base::saturated_cast<float>(Opacity()));
|
||||||
|
|
||||||
_updateAntiAliasingMode(_renderEngine.get());
|
_updateAntiAliasingMode(_renderEngine.get());
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "../buffer/out/search.h"
|
#include "../buffer/out/search.h"
|
||||||
#include "cppwinrt_utils.h"
|
#include "cppwinrt_utils.h"
|
||||||
|
|
||||||
|
#include <til/ticket_lock.h>
|
||||||
|
|
||||||
namespace ControlUnitTests
|
namespace ControlUnitTests
|
||||||
{
|
{
|
||||||
class ControlCoreTests;
|
class ControlCoreTests;
|
||||||
|
@ -57,7 +59,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
void UpdateSettings(const Control::IControlSettings& settings, const IControlAppearance& newAppearance);
|
void UpdateSettings(const Control::IControlSettings& settings, const IControlAppearance& newAppearance);
|
||||||
void ApplyAppearance(const bool& focused);
|
void ApplyAppearance(const bool& focused);
|
||||||
// void UpdateAppearance(const Control::IControlAppearance& newAppearance);
|
// void UpdateAppearance(const Control::IControlAppearance& newAppearance);
|
||||||
Control::IControlSettings Settings() const { return *_settings; };
|
Control::IControlSettings Settings()
|
||||||
|
{
|
||||||
|
auto l = std::unique_lock<til::ticket_lock>{ _settingsLock };
|
||||||
|
return *_settings;
|
||||||
|
};
|
||||||
Control::IControlAppearance FocusedAppearance() const { return *_settings->FocusedAppearance(); };
|
Control::IControlAppearance FocusedAppearance() const { return *_settings->FocusedAppearance(); };
|
||||||
Control::IControlAppearance UnfocusedAppearance() const { return *_settings->UnfocusedAppearance(); };
|
Control::IControlAppearance UnfocusedAppearance() const { return *_settings->UnfocusedAppearance(); };
|
||||||
|
|
||||||
|
@ -200,6 +206,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
TerminalConnection::ITerminalConnection::StateChanged_revoker _connectionStateChangedRevoker;
|
TerminalConnection::ITerminalConnection::StateChanged_revoker _connectionStateChangedRevoker;
|
||||||
|
|
||||||
winrt::com_ptr<ControlSettings> _settings{ nullptr };
|
winrt::com_ptr<ControlSettings> _settings{ nullptr };
|
||||||
|
til::ticket_lock _settingsLock;
|
||||||
|
|
||||||
std::unique_ptr<::Microsoft::Terminal::Core::Terminal> _terminal{ nullptr };
|
std::unique_ptr<::Microsoft::Terminal::Core::Terminal> _terminal{ nullptr };
|
||||||
|
|
||||||
|
|
|
@ -464,11 +464,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
RootGrid().Background(acrylic);
|
RootGrid().Background(acrylic);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GH#5098: Inform the engine of the new opacity of the default text background.
|
// // GH#5098: Inform the engine of the new opacity of the default text background.
|
||||||
//
|
// //
|
||||||
// TODO! This sure seems contrived, shouldn't the core... already
|
// // TODO! This sure seems contrived, shouldn't the core... already
|
||||||
// know this?
|
// // know this?
|
||||||
_core.SetBackgroundOpacity(_core.Opacity());
|
// _core.SetBackgroundOpacity(_core.Opacity());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -476,8 +476,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
solidColor.Opacity(_core.Opacity());
|
solidColor.Opacity(_core.Opacity());
|
||||||
RootGrid().Background(solidColor);
|
RootGrid().Background(solidColor);
|
||||||
|
|
||||||
// GH#5098: Inform the engine of the new opacity of the default text background.
|
// // GH#5098: Inform the engine of the new opacity of the default text background.
|
||||||
_core.SetBackgroundOpacity(_core.Opacity());
|
// // TODO! here too
|
||||||
|
// _core.SetBackgroundOpacity(_core.Opacity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue