ddraw: Mark surfaces as lost on mode changes.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2015-12-08 14:27:18 +01:00 committed by Alexandre Julliard
parent 79636bebbf
commit 571dc0faa5
5 changed files with 167 additions and 2 deletions

View File

@ -1120,7 +1120,6 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
/* TODO: The possible return values from msdn suggest that the screen mode
* can't be changed if a surface is locked or some drawing is in progress. */
/* TODO: Lose the primary surface. */
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode)))
ddraw->flags |= DDRAW_RESTORE_MODE;
@ -4675,6 +4674,8 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
/* This is run from device_process_message() in wined3d, we can't take the
* wined3d mutex. */
/* FIXME: We only get mode change notifications in exclusive mode, but we
* should mark surfaces as lost on mode changes in DDSCL_NORMAL mode as well. */
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
{
struct ddraw *ddraw = ddraw_from_device_parent(device_parent);
@ -4704,6 +4705,8 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic
if (!SetWindowPos(ddraw->swapchain_window, HWND_TOP, r->left, r->top,
r->right - r->left, r->bottom - r->top, SWP_SHOWWINDOW | SWP_NOACTIVATE))
ERR("Failed to resize window.\n");
InterlockedCompareExchange(&ddraw->device_state, DDRAW_DEVICE_STATE_NOT_RESTORED, DDRAW_DEVICE_STATE_OK);
}
static void CDECL device_parent_activate(struct wined3d_device_parent *device_parent, BOOL activate)

View File

@ -2388,8 +2388,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2434,8 +2438,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2452,6 +2460,8 @@ static void test_coop_level_mode_set(void)
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
memset(&devmode, 0, sizeof(devmode));
devmode.dmSize = sizeof(devmode);
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
@ -2502,8 +2512,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2588,11 +2602,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2608,6 +2626,8 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */)
{
@ -2617,6 +2637,10 @@ static void test_coop_level_mode_set(void)
goto done;
}
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2659,8 +2683,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2751,11 +2779,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2771,8 +2803,14 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2815,8 +2853,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;

View File

@ -2555,8 +2555,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2601,8 +2605,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2671,8 +2679,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw2_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2757,11 +2769,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2777,6 +2793,8 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */)
{
@ -2786,6 +2804,10 @@ static void test_coop_level_mode_set(void)
goto done;
}
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2828,8 +2850,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2920,11 +2946,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2940,8 +2970,14 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2984,8 +3020,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw2_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;

View File

@ -2740,8 +2740,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2786,8 +2790,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2856,8 +2864,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw4_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2942,11 +2954,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2962,8 +2978,14 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface4_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -3006,8 +3028,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw4_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -3098,11 +3124,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -3118,8 +3148,14 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface4_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -3162,8 +3198,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface4_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw4_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;

View File

@ -2471,8 +2471,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2517,8 +2521,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2587,8 +2595,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw7_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2673,11 +2685,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2693,8 +2709,14 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface7_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2737,8 +2759,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDraw_RestoreDisplayMode(ddraw);
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw7_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2829,11 +2855,15 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmPelsWidth = param.user32_width;
devmode.dmPelsHeight = param.user32_height;
change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN);
ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret);
hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2849,8 +2879,14 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDrawSurface7_Restore(primary);
todo_wine ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
@ -2893,8 +2929,12 @@ static void test_coop_level_mode_set(void)
screen_size.cx = 0;
screen_size.cy = 0;
hr = IDirectDrawSurface7_IsLost(primary);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw7_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;