Minor tweaks.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-10-25 09:57:11 +08:00
parent 955961cf9b
commit 7c255ea79e
3 changed files with 11 additions and 6 deletions

View File

@ -10,7 +10,7 @@ win32 {
_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS
CONFIG += windeployqt CONFIG += windeployqt
CONFIG -= embed_manifest_exe CONFIG -= embed_manifest_exe
LIBS += -luser32 -lshell32 -lgdi32 -ldwmapi -lshcore -ld2d1 LIBS += -luser32 -lshell32 -lgdi32 -ldwmapi -lshcore -ld2d1 -luxtheme
RC_FILE = $$PWD/windows.rc RC_FILE = $$PWD/windows.rc
OTHER_FILES += $$PWD/windows.manifest OTHER_FILES += $$PWD/windows.manifest
} }

View File

@ -25,7 +25,7 @@ win32 {
SOURCES += winnativeeventfilter.cpp SOURCES += winnativeeventfilter.cpp
LINK_TO_SYSTEM_DLL { LINK_TO_SYSTEM_DLL {
DEFINES += WNEF_LINK_SYSLIB DEFINES += WNEF_LINK_SYSLIB
LIBS += -luser32 -lshell32 -lgdi32 -ldwmapi -lshcore -ld2d1 LIBS += -luser32 -lshell32 -lgdi32 -ldwmapi -lshcore -ld2d1 -luxtheme
} }
RC_FILE = framelesshelper.rc RC_FILE = framelesshelper.rc
} else { } else {

View File

@ -500,6 +500,7 @@ using WNEF_CORE_DATA = struct _WNEF_CORE_DATA
WNEF_GENERATE_WINAPI(PostMessageW, BOOL, HWND, UINT, WPARAM, LPARAM) WNEF_GENERATE_WINAPI(PostMessageW, BOOL, HWND, UINT, WPARAM, LPARAM)
WNEF_GENERATE_WINAPI(GetMessagePos, DWORD) WNEF_GENERATE_WINAPI(GetMessagePos, DWORD)
WNEF_GENERATE_WINAPI(SystemParametersInfoW, BOOL, UINT, UINT, PVOID, UINT) WNEF_GENERATE_WINAPI(SystemParametersInfoW, BOOL, UINT, UINT, PVOID, UINT)
WNEF_GENERATE_WINAPI(DwmGetColorizationColor, HRESULT, DWORD *, BOOL *)
#endif // WNEF_LINK_SYSLIB #endif // WNEF_LINK_SYSLIB
@ -638,6 +639,7 @@ using WNEF_CORE_DATA = struct _WNEF_CORE_DATA
WNEF_RESOLVE_WINAPI(Shell32, SHAppBarMessage) WNEF_RESOLVE_WINAPI(Shell32, SHAppBarMessage)
WNEF_RESOLVE_WINAPI(Kernel32, GetCurrentProcess) WNEF_RESOLVE_WINAPI(Kernel32, GetCurrentProcess)
// Available since Windows Vista. // Available since Windows Vista.
WNEF_RESOLVE_WINAPI(Dwmapi, DwmGetColorizationColor)
WNEF_RESOLVE_WINAPI(User32, IsProcessDPIAware) WNEF_RESOLVE_WINAPI(User32, IsProcessDPIAware)
WNEF_RESOLVE_WINAPI(Dwmapi, DwmGetWindowAttribute) WNEF_RESOLVE_WINAPI(Dwmapi, DwmGetWindowAttribute)
WNEF_RESOLVE_WINAPI(Dwmapi, DwmIsCompositionEnabled) WNEF_RESOLVE_WINAPI(Dwmapi, DwmIsCompositionEnabled)
@ -2518,16 +2520,19 @@ bool WinNativeEventFilter::colorizationEnabled()
QColor WinNativeEventFilter::colorizationColor() QColor WinNativeEventFilter::colorizationColor()
{ {
/* #if 1
DWORD color = 0; DWORD color = 0;
BOOL opaqueBlend = FALSE; BOOL opaqueBlend = FALSE;
return SUCCEEDED(DwmGetColorizationColor(&color, &opaqueBlend)) ? QColor::fromRgba(color) return SUCCEEDED(
WNEF_EXECUTE_WINAPI_RETURN(DwmGetColorizationColor, E_FAIL, &color, &opaqueBlend))
? QColor::fromRgba(color)
: Qt::white; : Qt::white;
*/ #else
bool ok = false; bool ok = false;
const QSettings registry(g_sDwmRegistryKey, QSettings::NativeFormat); const QSettings registry(g_sDwmRegistryKey, QSettings::NativeFormat);
const quint64 color = registry.value(QLatin1String("ColorizationColor"), 0).toULongLong(&ok); const quint64 color = registry.value(QLatin1String("ColorizationColor"), 0).toULongLong(&ok);
return ok ? QColor::fromRgba(color) : Qt::white; return ok ? QColor::fromRgba(color) : Qt::white;
#endif
} }
bool WinNativeEventFilter::lightThemeEnabled() bool WinNativeEventFilter::lightThemeEnabled()