[PATCH 4/5] strmbase: Correctly implement IVideoWindow::put_Owner().
Zebediah Figura
z.figura12 at gmail.com
Mon Oct 7 18:55:45 CDT 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
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 ae467ed71aa..f4c3f92e289 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 f280b323ab0..446c389220b 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;
}
--
2.23.0
More information about the wine-devel
mailing list