From f3a39ff166d15d3df5a741ffac42e4bc47656c8e Mon Sep 17 00:00:00 2001 From: ALTaleX <2368730049@qq.com> Date: Thu, 17 Aug 2023 23:14:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E8=A2=AB?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TFMain/ToolTipHandler.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/TFMain/ToolTipHandler.cpp b/TFMain/ToolTipHandler.cpp index d39e752..949f289 100644 --- a/TFMain/ToolTipHandler.cpp +++ b/TFMain/ToolTipHandler.cpp @@ -67,6 +67,18 @@ HRESULT WINAPI TranslucentFlyouts::ToolTipHandler::DrawThemeBackground( if (!_wcsicmp(themeClassName, L"Tooltip")) { + DWORD itemDisabled + { + RegHelper::GetDword( + L"Tooltip", + L"Disabled", + 0 + ) + }; + RETURN_HR_IF_EXPECTED( + E_NOTIMPL, itemDisabled + ); + g_darkMode = ThemeHelper::DetermineThemeMode(hTheme, L"Explorer"sv, L"Tooltip"sv, 0, 0, TMT_TEXTCOLOR); HWND hWnd{WindowFromDC(hdc)}; @@ -135,6 +147,17 @@ int WINAPI ToolTipHandler::DrawTextW( RETURN_HR_IF_EXPECTED( E_NOTIMPL, !g_useUxTheme ); + DWORD itemDisabled + { + RegHelper::GetDword( + L"Tooltip", + L"Disabled", + 0 + ) + }; + RETURN_HR_IF_EXPECTED( + E_NOTIMPL, itemDisabled + ); HWND hWnd{ WindowFromDC(hdc) }; RETURN_LAST_ERROR_IF_NULL_EXPECTED(hWnd); RETURN_HR_IF_EXPECTED( @@ -185,6 +208,10 @@ void ToolTipHandler::AttachTooltip(HWND hWnd) g_tooltipList.push_back(hWnd); SetWindowSubclass(hWnd, SubclassProc, tooltipSubclassId, 0); + + TFMain::ApplyBackdropEffect(L"Tooltip", hWnd, g_darkMode, TFMain::darkMode_GradientColor, TFMain::lightMode_GradientColor); + TFMain::ApplyRoundCorners(L"Tooltip", hWnd); + TFMain::ApplySysBorderColors(L"Tooltip", hWnd, g_darkMode, DWMWA_COLOR_NONE, DWMWA_COLOR_NONE); } void ToolTipHandler::DetachTooltip(HWND hWnd) { @@ -245,9 +272,6 @@ void ToolTipHandler::WinEventCallback(HWND hWnd, DWORD event) if (g_useUxTheme) { AttachTooltip(hWnd); - TFMain::ApplyBackdropEffect(L"Tooltip", hWnd, g_darkMode, TFMain::darkMode_GradientColor, TFMain::lightMode_GradientColor); - TFMain::ApplyRoundCorners(L"Tooltip", hWnd); - TFMain::ApplySysBorderColors(L"Tooltip", hWnd, g_darkMode, DWMWA_COLOR_NONE, DWMWA_COLOR_NONE); } } }