strmbase: More properly implement IVideoWindow::SetWindowForeground().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Zebediah Figura 2019-10-08 20:02:21 -05:00 committed by Alexandre Julliard
parent a3d3b399ff
commit cc3f73be74
2 changed files with 13 additions and 17 deletions

View File

@ -1619,7 +1619,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
top = get_top_window();
todo_wine ok(top == hwnd, "Got top window %p.\n", top);
ok(top == hwnd, "Got top window %p.\n", top);
hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -1632,9 +1632,9 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
todo_wine ok(GetFocus() == our_hwnd, "Got focus window %p.\n", GetFocus());
todo_wine ok(GetForegroundWindow() == our_hwnd, "Got foreground window %p.\n", GetForegroundWindow());
ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
ok(GetFocus() == our_hwnd, "Got focus window %p.\n", GetFocus());
ok(GetForegroundWindow() == our_hwnd, "Got foreground window %p.\n", GetForegroundWindow());
top = get_top_window();
ok(top == hwnd, "Got top window %p.\n", top);
}

View File

@ -654,29 +654,25 @@ HRESULT WINAPI BaseControlWindowImpl_put_FullScreenMode(IVideoWindow *iface, LON
return E_NOTIMPL;
}
HRESULT WINAPI BaseControlWindowImpl_SetWindowForeground(IVideoWindow *iface, LONG Focus)
HRESULT WINAPI BaseControlWindowImpl_SetWindowForeground(IVideoWindow *iface, LONG focus)
{
BaseControlWindow* This = impl_from_IVideoWindow(iface);
BOOL ret;
BaseControlWindow *window = impl_from_IVideoWindow(iface);
UINT flags = SWP_NOMOVE | SWP_NOSIZE;
IPin* pPin;
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
TRACE("window %p, focus %d.\n", window, focus);
if ((Focus != OAFALSE) && (Focus != OATRUE))
if (focus != OAFALSE && focus != OATRUE)
return E_INVALIDARG;
hr = IPin_ConnectedTo(&This->pPin->IPin_iface, &pPin);
hr = IPin_ConnectedTo(&window->pPin->IPin_iface, &pPin);
if ((hr != S_OK) || !pPin)
return VFW_E_NOT_CONNECTED;
if (Focus)
ret = SetForegroundWindow(This->baseWindow.hWnd);
else
ret = SetWindowPos(This->baseWindow.hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
if (!ret)
return E_FAIL;
if (!focus)
flags |= SWP_NOACTIVATE;
SetWindowPos(window->baseWindow.hWnd, HWND_TOP, 0, 0, 0, 0, flags);
return S_OK;
}