From 5a0e5a9261c251dba54afb8cc0b6b32ae9d95510 Mon Sep 17 00:00:00 2001
From: Zhao Yuhang <2546789017@qq.com>
Date: 周二, 12 12月 2023 19:50:34 +0800
Subject: [PATCH] add theme win32 message

---
 src/core/contexts/win32windowcontext.cpp |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index 8ed1f39..372d0c5 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -805,12 +805,12 @@
             }
 
             case DefaultColorsHook: {
-                auto map = *reinterpret_cast<QMap<QString, QColor> *>(data);
+                auto &map = *static_cast<QMap<QString, QColor> *>(data);
                 map.clear();
-                map.insert("activeLight", kWindowsColorSet.activeLight);
-                map.insert("activeDark", kWindowsColorSet.activeDark);
-                map.insert("inactiveLight", kWindowsColorSet.inactiveLight);
-                map.insert("inactiveDark", kWindowsColorSet.inactiveDark);
+                map.insert(QStringLiteral("activeLight"), kWindowsColorSet.activeLight);
+                map.insert(QStringLiteral("activeDark"), kWindowsColorSet.activeDark);
+                map.insert(QStringLiteral("inactiveLight"), kWindowsColorSet.inactiveLight);
+                map.insert(QStringLiteral("inactiveDark"), kWindowsColorSet.inactiveDark);
                 return;
             }
 
@@ -894,6 +894,10 @@
 
         // Whether to show system menu
         if (systemMenuHandler(hWnd, message, wParam, lParam, result)) {
+            return true;
+        }
+
+        if (themeStuffHandler(hWnd, message, wParam, lParam, result)) {
             return true;
         }
 
@@ -1883,6 +1887,47 @@
         return false;
     }
 
+    bool Win32WindowContext::themeStuffHandler(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam,
+                           LRESULT *resul)
+    {
+        switch (message) {
+            case WM_DPICHANGED: {
+                const auto dpiX = UINT(LOWORD(wParam));
+                const auto dpiY = UINT(HIWORD(wParam));
+                break;
+            }
+            case WM_THEMECHANGED:
+            case WM_SYSCOLORCHANGE: {
+                break;
+            }
+            case WM_DWMCOLORIZATIONCOLORCHANGED: {
+                const QColor color = QColor::fromRgba(wParam);
+                const auto blendWithOpacity = *reinterpret_cast<LPBOOL>(lParam);
+                break;
+            }
+            case WM_SETTINGCHANGE: {
+                if (!wParam && lParam && std::wcscmp(reinterpret_cast<LPCWSTR>(lParam), L"ImmersiveColorSet") == 0) {
+                    const QColor color = getAccentColor();
+                }
+                break;
+            }
+            case WM_SIZE: {
+                const bool max = wParam == SIZE_MAXIMIZED;
+                const bool min = wParam == SIZE_MINIMIZED;
+                const bool full = isFullScreen(hWnd);
+                break;
+            }
+            case WM_ACTIVATE: {
+                const auto state = LOWORD(wParam);
+                const bool active = state == WA_ACTIVE || state == WA_CLICKACTIVE;
+                break;
+            }
+            default:
+                break;
+        }
+        return false;
+    }
+
     void Win10BorderHandler::paintBorder(QPainter &painter, const QRect &rect,
                                          const QRegion &region) {
         Q_UNUSED(rect)

--
Gitblit v1.9.1