From a12bb8782bd02305466a29101a4c54d6ba9c6bfe Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 摹曛, 28 12月 2023 16:03:06 +0800
Subject: [PATCH] minor tweaks

---
 src/widgets/widgetwindowagent_win.cpp    |    6 +++---
 CMakeLists.txt                           |    2 +-
 src/core/contexts/win32windowcontext.cpp |    6 +-----
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c50df46..aec37b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.17)
 
-project(QWindowKit VERSION 2.5.1.1 LANGUAGES CXX)
+project(QWindowKit VERSION 1.0.1.0 LANGUAGES CXX)
 
 # ----------------------------------
 # Build Options
diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index a41d110..e4707dc 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -680,7 +680,7 @@
     }
 
     QVariant Win32WindowContext::windowAttribute(const QString &key) const {
-        if (key == QStringLiteral("title-bar-rect")) {
+        if (key == QStringLiteral("window-rect")) {
             if (!m_windowHandle)
                 return {};
 
@@ -696,10 +696,6 @@
             } else {
                 ::AdjustWindowRectEx(&frame, style, FALSE, exStyle);
             }
-            frame.left = std::abs(frame.left);
-            frame.top = std::abs(frame.top);
-            frame.right = std::abs(frame.right);
-            frame.bottom = std::abs(frame.bottom);
             return QVariant::fromValue(rect2qrect(frame));
         }
 
diff --git a/src/widgets/widgetwindowagent_win.cpp b/src/widgets/widgetwindowagent_win.cpp
index 02ea7e5..72d0057 100644
--- a/src/widgets/widgetwindowagent_win.cpp
+++ b/src/widgets/widgetwindowagent_win.cpp
@@ -110,8 +110,8 @@
             // When the window is inactive, there is a transparency bug in the top
             // border, and we need to extend the non-client area to the whole title
             // bar.
-            QRect frame = ctx->windowAttribute(QStringLiteral("title-bar-rect")).toRect();
-            QMargins margins{0, frame.top(), 0, 0};
+            QRect frame = ctx->windowAttribute(QStringLiteral("window-rect")).toRect();
+            QMargins margins{0, -frame.top(), 0, 0};
             ctx->setWindowAttribute(QStringLiteral("extra-margins"), QVariant::fromValue(margins));
         }
 
@@ -164,7 +164,7 @@
 
         bool eventFilter(QObject *obj, QEvent *event) override {
             Q_UNUSED(obj)
-            
+
             switch (event->type()) {
                 case QEvent::UpdateRequest: {
                     if (!isNormalWindow())

--
Gitblit v1.9.1