From 7cd6c960cb1000889b0977ec518311e354e5828c Mon Sep 17 00:00:00 2001
From: Zhao Yuhang <2546789017@qq.com>
Date: 周五, 10 1月 2025 19:35:49 +0800
Subject: [PATCH] update qmsetup

---
 src/core/contexts/win32windowcontext.cpp |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index 6d54ad6..3c7ba80 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -948,7 +948,7 @@
 
         if (key == QStringLiteral("extra-margins")) {
             auto margins = qmargins2margins(attribute.value<QMargins>());
-            return apis.pDwmExtendFrameIntoClientArea(hwnd, &margins) == S_OK;
+            return SUCCEEDED(apis.pDwmExtendFrameIntoClientArea(hwnd, &margins));
         }
 
         if (key == QStringLiteral("dark-mode")) {
@@ -962,12 +962,8 @@
             } else {
                 apis.pAllowDarkModeForApp(enable);
             }
-            for (const auto attr : {
-                     _DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1,
-                     _DWMWA_USE_IMMERSIVE_DARK_MODE,
-                 }) {
-                apis.pDwmSetWindowAttribute(hwnd, attr, &enable, sizeof(enable));
-            }
+            const auto attr = isWin1020H1OrGreater() ? _DWMWA_USE_IMMERSIVE_DARK_MODE : _DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
+            apis.pDwmSetWindowAttribute(hwnd, attr, &enable, sizeof(enable));
 
             apis.pFlushMenuThemes();
             return true;

--
Gitblit v1.9.1