Zebediah Figura : strmbase: Correctly implement IVideoWindow::put_Owner().

Alexandre Julliard julliard at winehq.org
Tue Oct 8 16:05:56 CDT 2019


Module: wine
Branch: master
Commit: 9b98246e82fabed674d04a7e637dd78ae0e8b3fd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9b98246e82fabed674d04a7e637dd78ae0e8b3fd

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Oct  7 18:55:45 2019 -0500

strmbase: Correctly implement IVideoWindow::put_Owner().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/videorenderer.c |  4 ++--
 dlls/strmbase/window.c            | 27 +++++++++++++--------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index ae467ed71a..f4c3f92e28 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -1795,9 +1795,9 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == our_hwnd, "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    todo_wine ok((style & WS_CHILD), "Got style %#x.\n", style);
+    ok((style & WS_CHILD), "Got style %#x.\n", style);
 
-    todo_wine ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
+    ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
     ok(top_hwnd == our_hwnd, "Got top window %p.\n", top_hwnd);
 
diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c
index f280b323ab..446c389220 100644
--- a/dlls/strmbase/window.c
+++ b/dlls/strmbase/window.c
@@ -558,23 +558,22 @@ HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *pHeig
     return S_OK;
 }
 
-HRESULT WINAPI BaseControlWindowImpl_put_Owner(IVideoWindow *iface, OAHWND Owner)
+HRESULT WINAPI BaseControlWindowImpl_put_Owner(IVideoWindow *iface, OAHWND owner)
 {
-    BaseControlWindow*  This = impl_from_IVideoWindow(iface);
+    BaseControlWindow *window = impl_from_IVideoWindow(iface);
+    HWND hwnd = window->baseWindow.hWnd;
 
-    TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
+    TRACE("window %p, owner %#lx.\n", window, owner);
 
-    This->hwndOwner = (HWND)Owner;
-    SetParent(This->baseWindow.hWnd, This->hwndOwner);
-    if (This->baseWindow.WindowStyles & WS_CHILD)
-    {
-        LONG old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
-        if (old != This->baseWindow.WindowStyles)
-        {
-            SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, This->baseWindow.WindowStyles);
-            SetWindowPos(This->baseWindow.hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
-        }
-    }
+    /* Make sure we are marked as WS_CHILD before reparenting ourselves, so that
+     * we do not steal focus. LEGO Island depends on this. */
+
+    window->hwndOwner = (HWND)owner;
+    if (owner)
+        SetWindowLongPtrW(hwnd, GWL_STYLE, GetWindowLongPtrW(hwnd, GWL_STYLE) | WS_CHILD);
+    else
+        SetWindowLongPtrW(hwnd, GWL_STYLE, GetWindowLongPtrW(hwnd, GWL_STYLE) & ~WS_CHILD);
+    SetParent(hwnd, (HWND)owner);
 
     return S_OK;
 }




More information about the wine-cvs mailing list