5/6 transparency cases seem to work. Previewing with unfocused apprearance is broken again.

This commit is contained in:
Mike Griese 2021-11-10 15:42:10 -06:00
parent 5cd8096d42
commit 713f72e1e5
5 changed files with 17 additions and 8 deletions

View file

@ -92,7 +92,7 @@ namespace winrt::TerminalApp::implementation
{
// Clear the saved preview funcs because we don't need to add a restore each time
// the preview color changes, we only need to be able to restore the last one.
_restorePreviewFuncs.clear();
// _restorePreviewFuncs.clear();
_ApplyToActiveControls([&](const auto& control) {
// Stash a copy of the original scheme.
@ -127,9 +127,10 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_PreviewActionHandler(const IInspectable& /*sender*/,
const Microsoft::Terminal::Settings::Model::Command& args)
{
_EndPreview();
if (args == nullptr || args.ActionAndArgs() == nullptr)
{
_EndPreview();
// _EndPreview();
}
else
{

View file

@ -277,7 +277,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// GH#5098: Inform the engine of the opacity of the default text background.
// GH#11315: Always do this, even if they don't have acrylic on.
_renderEngine->SetDefaultTextBackgroundOpacity(UseAcrylic());
_renderEngine->SetDefaultTextBackgroundOpacity(_correctForTransparency());
THROW_IF_FAILED(_renderEngine->Enable());
@ -459,7 +459,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// GH#5098: Inform the engine of the new opacity of the default
// text background.
auto lock = _terminal->LockForWriting();
_renderEngine->SetDefaultTextBackgroundOpacity(UseAcrylic());
_renderEngine->SetDefaultTextBackgroundOpacity(_correctForTransparency());
}
}
@ -629,7 +629,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_renderEngine->SetForceFullRepaintRendering(_settings->ForceFullRepaintRendering());
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
// Inform the renderer of our opacity
_renderEngine->SetDefaultTextBackgroundOpacity(UseAcrylic());
_renderEngine->SetDefaultTextBackgroundOpacity(_correctForTransparency());
_updateAntiAliasingMode(_renderEngine.get());
@ -1632,6 +1632,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_settings->FocusedAppearance()->SetColorTableEntry(15, scheme.BrightWhite);
_terminal->ApplyScheme(scheme);
_renderEngine->SetSelectionBackground(til::color{ _settings->SelectionBackground() });
_renderer->TriggerRedrawAll();
_BackgroundColorChangedHandlers(*this, nullptr);
@ -1641,4 +1642,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
return _settings->HasUnfocusedAppearance();
}
bool ControlCore::_correctForTransparency()
{
return Opacity() < 1.0f || UseAcrylic();
}
}

View file

@ -274,6 +274,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void _connectionOutputHandler(const hstring& hstr);
void _updateHoveredCell(const std::optional<til::point> terminalPosition);
bool _correctForTransparency();
inline bool _IsClosing() const noexcept
{
#ifndef NDEBUG

View file

@ -88,7 +88,7 @@ DxEngine::DxEngine() :
_forceFullRepaintRendering{ false },
_softwareRendering{ false },
_antialiasingMode{ D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE },
_defaultBackgroundIsTransparent{ false },
_defaultBackgroundIsTransparent{ 0xff000000 },
_hwndTarget{ static_cast<HWND>(INVALID_HANDLE_VALUE) },
_sizeTarget{},
_dpi{ USER_DEFAULT_SCREEN_DPI },
@ -2248,7 +2248,7 @@ CATCH_LOG()
void DxEngine::SetDefaultTextBackgroundOpacity(const bool useAcrylic) noexcept
try
{
_defaultBackgroundIsTransparent = useAcrylic;
_defaultBackgroundIsTransparent = useAcrylic ? 0xff000000 : 0;
// Make sure we redraw all the cells, to update whether they're actually
// drawn with cleartype or not.

View file

@ -257,7 +257,7 @@ namespace Microsoft::Console::Render
D2D1_TEXT_ANTIALIAS_MODE _antialiasingMode;
bool _defaultBackgroundIsTransparent;
uint32_t _defaultBackgroundIsTransparent;
bool _intenseIsBold;
// DirectX constant buffers need to be a multiple of 16; align to pad the size.