From: Paul Gofman <pgofman@codeweavers.com> --- dlls/quartz/tests/videorenderer.c | 9 +++++++++ dlls/quartz/tests/vmr7.c | 9 +++++++++ dlls/quartz/tests/vmr9.c | 9 +++++++++ dlls/quartz/window.c | 19 ++++++++++++++++--- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 54681e68304..666321dc844 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -2063,6 +2063,15 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our ok(top == 200, "Got top %ld.\n", top); ok(width == 300, "Got width %ld.\n", width); ok(height == 400, "Got height %ld.\n", height); + + left = top = width = height = 0xdeadbeef; + hr = IVideoWindow_GetRestorePosition(window, &left, &top, &width, &height); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(left == 100, "Got left %ld.\n", left); + ok(top == 200, "Got top %ld.\n", top); + ok(width == 300, "Got width %ld.\n", width); + ok(height == 400, "Got height %ld.\n", height); + GetWindowRect(hwnd, &rect); ok(rect.left == 100, "Got window left %ld.\n", rect.left); ok(rect.top == 200, "Got window top %ld.\n", rect.top); diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index e1bb00a20de..3ead6105da9 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -2080,6 +2080,15 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our ok(top == 200, "Got top %ld.\n", top); ok(width == 300, "Got width %ld.\n", width); ok(height == 400, "Got height %ld.\n", height); + + left = top = width = height = 0xdeadbeef; + hr = IVideoWindow_GetRestorePosition(window, &left, &top, &width, &height); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(left == 100, "Got left %ld.\n", left); + ok(top == 200, "Got top %ld.\n", top); + ok(width == 300, "Got width %ld.\n", width); + ok(height == 400, "Got height %ld.\n", height); + GetWindowRect(hwnd, &rect); ok(rect.left == 100, "Got window left %ld.\n", rect.left); ok(rect.top == 200, "Got window top %ld.\n", rect.top); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 1c24a1f70e7..ee7263382cd 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -2289,6 +2289,15 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our ok(top == 200, "Got top %ld.\n", top); ok(width == 300, "Got width %ld.\n", width); ok(height == 400, "Got height %ld.\n", height); + + left = top = width = height = 0xdeadbeef; + hr = IVideoWindow_GetRestorePosition(window, &left, &top, &width, &height); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(left == 100, "Got left %ld.\n", left); + ok(top == 200, "Got top %ld.\n", top); + ok(width == 300, "Got width %ld.\n", width); + ok(height == 400, "Got height %ld.\n", height); + GetWindowRect(hwnd, &rect); ok(rect.left == 100, "Got window left %ld.\n", rect.left); ok(rect.top == 200, "Got window top %ld.\n", rect.top); diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c index 50fee32946c..1fcd45372cf 100644 --- a/dlls/quartz/window.c +++ b/dlls/quartz/window.c @@ -682,12 +682,25 @@ HRESULT WINAPI BaseControlWindowImpl_GetMaxIdealImageSize(IVideoWindow *iface, L return S_OK; } -HRESULT WINAPI BaseControlWindowImpl_GetRestorePosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight) +HRESULT WINAPI BaseControlWindowImpl_GetRestorePosition(IVideoWindow *iface, LONG *left, LONG *top, LONG *width, LONG *height) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); + MONITORINFO info = { .cbSize = sizeof(info) }; + WINDOWPLACEMENT p; + HMONITOR mon; + + TRACE("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", window, iface, left, top, width, height); - FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight); + if (!GetMonitorInfoW((mon = MonitorFromWindow(window->hwnd, MONITOR_DEFAULTTONEAREST)), &info)) + return E_FAIL; + + if (!GetWindowPlacement(window->hwnd, &p)) + return E_FAIL; + *left = p.rcNormalPosition.left + info.rcWork.left; + *top = p.rcNormalPosition.top + info.rcWork.top; + *width = p.rcNormalPosition.right - p.rcNormalPosition.left; + *height = p.rcNormalPosition.bottom - p.rcNormalPosition.top; return S_OK; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11495