strmbase: Correctly implement IVideoWindow::NotifyOwnerMessage().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43367 Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7ca1c4900e
commit
54da011d2c
|
@ -1812,10 +1812,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;
|
||||
|
@ -1886,14 +1903,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);
|
||||
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n");
|
||||
CloseHandle(thread);
|
||||
|
||||
params.message = WM_SETCURSOR;
|
||||
thread = CreateThread(NULL, 0, notify_message_proc, ¶ms, 0, NULL);
|
||||
ok(!WaitForSingleObject(thread, 1000), "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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue