ddraw: Restore the registry display mode.

This commit is contained in:
Stefan Dösinger 2014-11-19 20:13:53 +01:00 committed by Alexandre Julliard
parent f4d520d6e2
commit f905c7c07a
5 changed files with 17 additions and 29 deletions

View File

@ -28,9 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static struct wined3d_display_mode original_mode;
static const struct ddraw *exclusive_ddraw;
static BOOL restore_mode;
/* Device identifier. Don't relay it to WineD3D */
static const DDDEVICEIDENTIFIER2 deviceidentifier =
@ -684,11 +682,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
return DDERR_NOEXCLUSIVEMODE;
}
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &original_mode)))
{
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, NULL)))
ddraw->flags &= ~DDRAW_RESTORE_MODE;
restore_mode = FALSE;
}
wined3d_mutex_unlock();
@ -1097,10 +1092,6 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
return DD_OK;
}
if (!restore_mode && FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d,
WINED3DADAPTER_DEFAULT, &original_mode, NULL)))
ERR("Failed to get current display mode, hr %#x.\n", hr);
switch (bpp)
{
case 8: format = WINED3DFMT_P8_UINT; break;
@ -1121,10 +1112,7 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
* 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;
restore_mode = TRUE;
}
wined3d_mutex_unlock();

View File

@ -2410,13 +2410,13 @@ static void test_coop_level_mode_set(void)
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth
ok(screen_size.cx == registry_mode.dmPelsWidth
&& screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r);
todo_wine ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom);
@ -2584,7 +2584,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
@ -2740,7 +2740,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,

View File

@ -2616,13 +2616,13 @@ static void test_coop_level_mode_set(void)
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth
ok(screen_size.cx == registry_mode.dmPelsWidth
&& screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r);
todo_wine ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom);
@ -2790,7 +2790,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
@ -2946,7 +2946,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,

View File

@ -2803,13 +2803,13 @@ static void test_coop_level_mode_set(void)
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth
ok(screen_size.cx == registry_mode.dmPelsWidth
&& screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r);
todo_wine ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom);
@ -2970,7 +2970,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
@ -3126,7 +3126,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,

View File

@ -2480,13 +2480,13 @@ static void test_coop_level_mode_set(void)
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL;
todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth
ok(screen_size.cx == registry_mode.dmPelsWidth
&& screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r);
todo_wine ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
ok(EqualRect(&r, &registry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom);
@ -2647,7 +2647,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
@ -2803,7 +2803,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,