From b02f12c4fd0e09589e5f3320644a22050104c928 Mon Sep 17 00:00:00 2001 From: Dustin Howett Date: Fri, 9 Aug 2024 13:57:59 -0500 Subject: [PATCH] all: remove alpha from SetSelectionBackground This required some changes to the WPF Control API surface --- src/cascadia/TerminalControl/HwndTerminal.cpp | 2 +- src/cascadia/TerminalControl/HwndTerminal.hpp | 1 - src/cascadia/WpfTerminalControl/TerminalTheme.cs | 5 ----- src/renderer/atlas/AtlasEngine.api.cpp | 2 +- src/renderer/atlas/AtlasEngine.h | 2 +- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cascadia/TerminalControl/HwndTerminal.cpp b/src/cascadia/TerminalControl/HwndTerminal.cpp index 5086515e975..4b8c345baac 100644 --- a/src/cascadia/TerminalControl/HwndTerminal.cpp +++ b/src/cascadia/TerminalControl/HwndTerminal.cpp @@ -882,7 +882,7 @@ void _stdcall TerminalSetTheme(void* terminal, TerminalTheme theme, LPCWSTR font renderSettings.SetColorTableEntry(TextColor::DEFAULT_FOREGROUND, theme.DefaultForeground); renderSettings.SetColorTableEntry(TextColor::DEFAULT_BACKGROUND, theme.DefaultBackground); - publicTerminal->_renderEngine->SetSelectionBackground(theme.DefaultSelectionBackground, theme.SelectionBackgroundAlpha); + publicTerminal->_renderEngine->SetSelectionBackground(theme.DefaultSelectionBackground); // Set the font colors for (size_t tableIndex = 0; tableIndex < 16; tableIndex++) diff --git a/src/cascadia/TerminalControl/HwndTerminal.hpp b/src/cascadia/TerminalControl/HwndTerminal.hpp index e561f1793fc..9a19b6090db 100644 --- a/src/cascadia/TerminalControl/HwndTerminal.hpp +++ b/src/cascadia/TerminalControl/HwndTerminal.hpp @@ -35,7 +35,6 @@ typedef struct _TerminalTheme COLORREF DefaultBackground; COLORREF DefaultForeground; COLORREF DefaultSelectionBackground; - float SelectionBackgroundAlpha; uint32_t CursorStyle; // This will be converted to DispatchTypes::CursorStyle (size_t), but C# cannot marshal an enum type and have it fit in a size_t. COLORREF ColorTable[16]; } TerminalTheme, *LPTerminalTheme; diff --git a/src/cascadia/WpfTerminalControl/TerminalTheme.cs b/src/cascadia/WpfTerminalControl/TerminalTheme.cs index 89e2ada53a4..699d1665609 100644 --- a/src/cascadia/WpfTerminalControl/TerminalTheme.cs +++ b/src/cascadia/WpfTerminalControl/TerminalTheme.cs @@ -70,11 +70,6 @@ public struct TerminalTheme /// public uint DefaultSelectionBackground; - /// - /// The opacity alpha for the selection color of the terminal, must be between 1.0 and 0.0. - /// - public float SelectionBackgroundAlpha; - /// /// The style of cursor to use in the terminal. /// diff --git a/src/renderer/atlas/AtlasEngine.api.cpp b/src/renderer/atlas/AtlasEngine.api.cpp index 9f4c3c075e6..0fefe0b914a 100644 --- a/src/renderer/atlas/AtlasEngine.api.cpp +++ b/src/renderer/atlas/AtlasEngine.api.cpp @@ -424,7 +424,7 @@ void AtlasEngine::SetRetroTerminalEffect(bool enable) noexcept } } -void AtlasEngine::SetSelectionBackground(const COLORREF color, const float /*alpha*/) noexcept +void AtlasEngine::SetSelectionBackground(const COLORREF color) noexcept { const u32 selectionColor = (color & 0xffffff) | 0xff000000; if (_api.s->misc->selectionColor != selectionColor) diff --git a/src/renderer/atlas/AtlasEngine.h b/src/renderer/atlas/AtlasEngine.h index 8c5bdc0df70..979847d21ac 100644 --- a/src/renderer/atlas/AtlasEngine.h +++ b/src/renderer/atlas/AtlasEngine.h @@ -71,7 +71,7 @@ namespace Microsoft::Console::Render::Atlas void SetPixelShaderPath(std::wstring_view value) noexcept; void SetPixelShaderImagePath(std::wstring_view value) noexcept; void SetRetroTerminalEffect(bool enable) noexcept; - void SetSelectionBackground(COLORREF color, float alpha = 0.5f) noexcept; + void SetSelectionBackground(COLORREF color) noexcept; void SetSoftwareRendering(bool enable) noexcept; void SetDisablePartialInvalidation(bool enable) noexcept; void SetGraphicsAPI(GraphicsAPI graphicsAPI) noexcept;