From fee0c64a8f8d6237f94457b608cc09614514f9b5 Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周六, 23 12月 2023 15:00:35 +0800
Subject: [PATCH] Fix window overflow

---
 src/core/contexts/win32windowcontext.cpp |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index 19f1864..27450d9 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -722,12 +722,15 @@
             DynamicApis::instance().pDwmExtendFrameIntoClientArea(hWnd, &margins);
         }
 
-#if !QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER)
         {
             auto style = ::GetWindowLongPtrW(hWnd, GWL_STYLE);
-            ::SetWindowLongPtrW(hWnd, GWL_STYLE, (style | WS_THICKFRAME) & (~WS_CAPTION));
-        }
+#if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER)
+            ::SetWindowLongPtrW(hWnd, GWL_STYLE, style & (~WS_SYSMENU));
+#else
+            ::SetWindowLongPtrW(hWnd, GWL_STYLE,
+                                (style | WS_THICKFRAME | WS_CAPTION) & (~WS_SYSMENU));
 #endif
+        }
 
         // Add managed window
         addManagedWindow(m_windowHandle, hWnd, this);
@@ -947,9 +950,9 @@
             }
 
             for (const auto attr : {
-                    _DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1,
-                    _DWMWA_USE_IMMERSIVE_DARK_MODE,
-            }) {
+                     _DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1,
+                     _DWMWA_USE_IMMERSIVE_DARK_MODE,
+                 }) {
                 apis.pDwmSetWindowAttribute(hwnd, attr, &enable, sizeof(enable));
             }
 
@@ -1810,11 +1813,16 @@
             // a window when it's maximized unless you restore it).
             const quint32 frameSize = getResizeBorderThickness(hWnd);
             clientRect->top += frameSize;
+
+#if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER)
             if (!isWin10OrGreater()) {
+#endif
                 clientRect->bottom -= frameSize;
                 clientRect->left += frameSize;
                 clientRect->right -= frameSize;
+#if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER)
             }
+#endif
         }
         // Attempt to detect if there's an autohide taskbar, and if
         // there is, reduce our size a bit on the side with the taskbar,

--
Gitblit v1.9.1