From 1095dbd2fe58a73fcc086b874891bdc879a34d4d Mon Sep 17 00:00:00 2001
From: SineStriker <trueful@163.com>
Date: 周一, 18 12月 2023 14:36:08 +0800
Subject: [PATCH] minor tweaks

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

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index 2cfd8b1..2a6ee76 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -117,7 +117,7 @@
     private:
         DynamicApis() {
 #define DYNAMIC_API_RESOLVE(DLL, NAME)                                                             \
-    p##NAME = reinterpret_cast<decltype(p##NAME)>(DLL.resolve(#NAME))
+  p##NAME = reinterpret_cast<decltype(p##NAME)>(DLL.resolve(#NAME))
 
             QSystemLibrary user32(QStringLiteral("user32"));
             DYNAMIC_API_RESOLVE(user32, GetDpiForWindow);
@@ -332,7 +332,7 @@
 
     static inline quint32 getDpiForWindow(HWND hwnd) {
         const DynamicApis &apis = DynamicApis::instance();
-        if (apis.pGetDpiForWindow) {         // Win10
+        if (apis.pGetDpiForWindow) { // Win10
             return apis.pGetDpiForWindow(hwnd);
         } else if (apis.pGetDpiForMonitor) { // Win8.1
             HMONITOR monitor = ::MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
@@ -780,7 +780,7 @@
         g_wndProcHash->insert(hWnd, ctx);
     }
 
-    static inline void removeManagedWindow(HWND hWnd, bool restore) {
+    static inline void removeManagedWindow(HWND hWnd) {
         // Remove window handle mapping
         if (!g_wndProcHash->remove(hWnd))
             return;
@@ -789,11 +789,6 @@
         if (g_wndProcHash->empty()) {
             WindowsNativeEventFilter::uninstall();
         }
-
-        // Restore window proc
-        if (restore) {
-            ::SetWindowLongPtrW(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(g_qtWindowProc));
-        }
     }
 
     Win32WindowContext::Win32WindowContext() : AbstractWindowContext() {
@@ -801,7 +796,7 @@
 
     Win32WindowContext::~Win32WindowContext() {
         if (windowId) {
-            removeManagedWindow(reinterpret_cast<HWND>(windowId), false);
+            removeManagedWindow(reinterpret_cast<HWND>(windowId));
         }
     }
 
@@ -897,11 +892,8 @@
         return getWindowFrameBorderThickness(reinterpret_cast<HWND>(windowId));
     }
 
-    void Win32WindowContext::winIdChanged(QWindow *oldWindow, bool destroyed) {
-        if (oldWindow) {
-            removeManagedWindow(reinterpret_cast<HWND>(windowId), !destroyed);
-        }
-
+    void Win32WindowContext::winIdChanged(QWindow *oldWindow) {
+        removeManagedWindow(reinterpret_cast<HWND>(windowId));
         if (!m_windowHandle) {
             return;
         }

--
Gitblit v1.9.1