[PATCH] quartz: Clear the WS_CHILD style in WM_CLOSE instead of unparenting it before.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Mar 16 07:52:08 CDT 2020


We handle it in WM_CLOSE to match Windows more closely, in case the window
belongs to a different thread.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48732
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/quartz/window.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c
index 0b0df13..48466fd 100644
--- a/dlls/quartz/window.c
+++ b/dlls/quartz/window.c
@@ -79,6 +79,14 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM
 
         This->Width = LOWORD(lparam);
         This->Height = HIWORD(lparam);
+        break;
+    case WM_CLOSE:
+        /* Media Player Classic deadlocks if WM_PARENTNOTIFY is sent, so clear
+         * the child style first. Just like Windows, we don't actually unparent
+         * the window, to prevent extra focus events from being generated since
+         * it would become top-level for a brief period before being destroyed. */
+        SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) & ~WS_CHILD);
+        break;
     }
 
     return DefWindowProcW(hwnd, message, wparam, lparam);
@@ -136,15 +144,9 @@ HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This)
 
 HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This)
 {
-    BaseControlWindow *window = impl_from_BaseWindow(This);
-
     if (!This->hWnd)
         return S_OK;
 
-    /* Media Player Classic deadlocks if WM_PARENTNOTIFY is sent, so unparent
-     * the window first. */
-    IVideoWindow_put_Owner(&window->IVideoWindow_iface, 0);
-
     SendMessageW(This->hWnd, WM_CLOSE, 0, 0);
     This->hWnd = NULL;
 
-- 
2.21.0




More information about the wine-devel mailing list