[PATCH 1/4] strmbase: Correctly implement IVideoWindow::NotifyOwnerMessage().
Zebediah Figura
z.figura12 at gmail.com
Thu Dec 5 18:44:10 CST 2019
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43367
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43765
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/quartz/tests/videorenderer.c | 40 +++++++++++++++++++++++++++++--
dlls/strmbase/window.c | 24 +++++++++++++++----
2 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index a9f938074b..320d8920d1 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -1888,10 +1888,27 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
ok(state == OATRUE, "Got state %d.\n", state);
}
+struct notify_message_params
+{
+ IVideoWindow *window;
+ HWND hwnd;
+ UINT message;
+};
+
+static DWORD CALLBACK notify_message_proc(void *arg)
+{
+ const struct notify_message_params *params = arg;
+ HRESULT hr = IVideoWindow_NotifyOwnerMessage(params->window, (OAHWND)params->hwnd, params->message, 0, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ return 0;
+}
+
static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our_hwnd)
{
+ struct notify_message_params params;
unsigned int i;
OAHWND oahwnd;
+ HANDLE thread;
HRESULT hr;
BOOL ret;
MSG msg;
@@ -1962,14 +1979,33 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
- todo_wine ok(!ret, "Got unexpected status %#x.\n", ret);
+ ok(!ret, "Got unexpected status %#x.\n", ret);
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SETCURSOR,
(WPARAM)hwnd, MAKELONG(HTCLIENT, WM_MOUSEMOVE));
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
- todo_wine ok(!ret, "Got unexpected status %#x.\n", ret);
+ ok(!ret, "Got unexpected status %#x.\n", ret);
+
+ params.window = window;
+ params.hwnd = our_hwnd;
+ params.message = WM_SYSCOLORCHANGE;
+ thread = CreateThread(NULL, 0, notify_message_proc, ¶ms, 0, NULL);
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block.\n");
+ ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
+ ok(ret == ((QS_SENDMESSAGE << 16) | QS_SENDMESSAGE), "Got unexpected status %#x.\n", ret);
+
+ PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE);
+ ok(!WaitForSingleObject(thread, 100), "Wait timed out.\n");
+ CloseHandle(thread);
+
+ params.message = WM_SETCURSOR;
+ thread = CreateThread(NULL, 0, notify_message_proc, ¶ms, 0, NULL);
+ ok(!WaitForSingleObject(thread, 100), "Thread should not block.\n");
+ CloseHandle(thread);
+ ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
+ ok(!ret, "Got unexpected status %#x.\n", ret);
hr = IVideoWindow_put_Owner(window, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c
index be6646c27a..04132aaab1 100644
--- a/dlls/strmbase/window.c
+++ b/dlls/strmbase/window.c
@@ -654,14 +654,28 @@ HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, LONG
return S_OK;
}
-HRESULT WINAPI BaseControlWindowImpl_NotifyOwnerMessage(IVideoWindow *iface, OAHWND hwnd, LONG uMsg, LONG_PTR wParam, LONG_PTR lParam)
+HRESULT WINAPI BaseControlWindowImpl_NotifyOwnerMessage(IVideoWindow *iface,
+ OAHWND hwnd, LONG message, LONG_PTR wparam, LONG_PTR lparam)
{
- BaseControlWindow* This = impl_from_IVideoWindow(iface);
+ BaseControlWindow *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
+ TRACE("window %p, hwnd %#lx, message %#x, wparam %#lx, lparam %#lx.\n",
+ window, hwnd, message, wparam, lparam);
- if (!PostMessageW(This->baseWindow.hWnd, uMsg, wParam, lParam))
- return E_FAIL;
+ /* That these messages are forwarded, and no others, is stated by the
+ * DirectX documentation, and supported by manual testing. */
+ switch (message)
+ {
+ case WM_ACTIVATEAPP:
+ case WM_DEVMODECHANGE:
+ case WM_DISPLAYCHANGE:
+ case WM_PALETTECHANGED:
+ case WM_PALETTEISCHANGING:
+ case WM_QUERYNEWPALETTE:
+ case WM_SYSCOLORCHANGE:
+ SendMessageW(window->baseWindow.hWnd, message, wparam, lparam);
+ break;
+ }
return S_OK;
}
--
2.24.0
More information about the wine-devel
mailing list