From 835e769f97eda4ff3ecc16ddca6d36c5496dc50d Mon Sep 17 00:00:00 2001
From: Zhao Yuhang <2546789017@qq.com>
Date: 摹曛, 06 3月 2025 18:32:04 +0800
Subject: [PATCH] fix build with old win-sdk

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

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index 3360b9d..0d70129 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -37,6 +37,10 @@
 #  error Current Qt version has a critical bug which will break QWK functionality. Please upgrade to > 6.6.1 or downgrade to < 6.6.0
 #endif
 
+#ifndef DWM_BB_ENABLE
+#  define DWM_BB_ENABLE 0x00000001
+#endif
+
 namespace QWK {
 
     enum IconButtonClickLevelFlag {
@@ -916,19 +920,12 @@
         Q_UNUSED(oldAttribute)
 
         const auto hwnd = reinterpret_cast<HWND>(m_windowId);
-        if (!hwnd) {
-            return false;
-        }
+        Q_ASSERT(hwnd);
 
         const DynamicApis &apis = DynamicApis::instance();
         const auto &extendMargins = [this, &apis, hwnd]() {
-            // For some unknown reason, the window background is totally black when the host object
-            // is a QWidget. And extending the window frame into the client area seems to fix it
-            // magically.
-            // We don't need the following *HACK* for QtQuick windows.
-            if (!m_host->isWidgetType()) {
-                return;
-            }
+            // For some unknown reason, the window background is totally black and extending
+            // the window frame into the client area seems to fix it magically.
             // After many times of trying, we found that the Acrylic/Mica/Mica Alt background
             // only appears on the native Win32 window's background, so naturally we want to
             // extend the window frame into the whole client area to be able to let the special
@@ -957,6 +954,7 @@
 
         const auto &effectBugWorkaround = [this, hwnd]() {
             // We don't need the following *HACK* for QWidget windows.
+            // Completely based on actual experiments, root reason is totally unknown.
             if (m_host->isWidgetType()) {
                 return;
             }

--
Gitblit v1.9.1