From d3d7430ec9afb94abaf78fa2c9edd9d9f946881c Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周一, 18 12月 2023 01:29:07 +0800
Subject: [PATCH] Add QtContext WinIdChange workaround

---
 src/core/contexts/win32windowcontext.cpp |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index 2cfd8b1..cda9058 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -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,9 +892,9 @@
         return getWindowFrameBorderThickness(reinterpret_cast<HWND>(windowId));
     }
 
-    void Win32WindowContext::winIdChanged(QWindow *oldWindow, bool destroyed) {
+    void Win32WindowContext::winIdChanged(QWindow *oldWindow) {
         if (oldWindow) {
-            removeManagedWindow(reinterpret_cast<HWND>(windowId), !destroyed);
+            removeManagedWindow(reinterpret_cast<HWND>(windowId));
         }
 
         if (!m_windowHandle) {

--
Gitblit v1.9.1