From ed5f9693b3cd7ddcdc746c4bb65dcd9cf7a8268b Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周二, 19 12月 2023 15:09:49 +0800 Subject: [PATCH] Add window attributes --- src/core/contexts/win32windowcontext.cpp | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index 2a6ee76..8af6a3f 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -117,7 +117,7 @@ private: DynamicApis() { #define DYNAMIC_API_RESOLVE(DLL, NAME) \ - p##NAME = reinterpret_cast<decltype(p##NAME)>(DLL.resolve(#NAME)) + p##NAME = reinterpret_cast<decltype(p##NAME)>(DLL.resolve(#NAME)) QSystemLibrary user32(QStringLiteral("user32")); DYNAMIC_API_RESOLVE(user32, GetDpiForWindow); @@ -332,7 +332,7 @@ static inline quint32 getDpiForWindow(HWND hwnd) { const DynamicApis &apis = DynamicApis::instance(); - if (apis.pGetDpiForWindow) { // Win10 + if (apis.pGetDpiForWindow) { // Win10 return apis.pGetDpiForWindow(hwnd); } else if (apis.pGetDpiForMonitor) { // Win8.1 HMONITOR monitor = ::MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); @@ -826,6 +826,23 @@ return; } + case WindowAttributeChangedHook: { + auto args = static_cast<void **>(data); + const auto &key = *static_cast<const QString *>(args[0]); + const auto &newVar = *static_cast<const QVariant *>(args[1]); + const auto &oldVar = *static_cast<const QVariant *>(args[2]); + + if (key == QStringLiteral("no-frame-shadow")) { + if (newVar.toBool()) { + // TODO: set off + } else { + // TODO: set on + } + } + + break; + } + case DefaultColorsHook: { auto &map = *static_cast<QMap<QString, QColor> *>(data); map.clear(); -- Gitblit v1.9.1