Gabriel Ivăncescu : quartz: Clear the WS_CHILD style instead of unparenting the window.

Alexandre Julliard julliard at winehq.org
Fri Aug 7 10:42:27 CDT 2020


Module: wine
Branch: stable
Commit: ee17ffb885618db995a529fa11d22153c830f3b0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ee17ffb885618db995a529fa11d22153c830f3b0

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Mon Mar 16 18:54:51 2020 +0200

quartz: Clear the WS_CHILD style instead of unparenting the window.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48732
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 5c8903a0a9fcef947d958c93a7fa05f9faa3bcb8)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/quartz/tests/filtergraph.c |  4 ++++
 dlls/strmbase/window.c          | 10 +++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index be1d61aae3..6254634209 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -4293,11 +4293,15 @@ static void test_window_threading(void)
     else
         skip("Could not find renderer window.\n");
 
+    SetActiveWindow(parent);
     expect_parent_message = FALSE;
     ref = IFilterGraph2_Release(graph);
     ok(!ref, "Got outstanding refcount %d.\n", ref);
     expect_parent_message = TRUE;
 
+    hwnd = GetActiveWindow();
+    ok(hwnd == parent, "Parent window lost focus, active window %p.\n", hwnd);
+
     hr = CoCreateInstance(&CLSID_FilterGraphNoThread, NULL, CLSCTX_INPROC_SERVER,
             &IID_IFilterGraph2, (void **)&graph);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c
index 963c7f2b02..31a57b854a 100644
--- a/dlls/strmbase/window.c
+++ b/dlls/strmbase/window.c
@@ -136,14 +136,14 @@ 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);
+    /* 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(This->hWnd, GWL_STYLE, GetWindowLongW(This->hWnd, GWL_STYLE) & ~WS_CHILD);
 
     SendMessageW(This->hWnd, WM_CLOSE, 0, 0);
     This->hWnd = NULL;




More information about the wine-cvs mailing list