Commit f905c7c0 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Restore the registry display mode.

parent f4d520d6
...@@ -28,9 +28,7 @@ ...@@ -28,9 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw); WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static struct wined3d_display_mode original_mode;
static const struct ddraw *exclusive_ddraw; static const struct ddraw *exclusive_ddraw;
static BOOL restore_mode;
/* Device identifier. Don't relay it to WineD3D */ /* Device identifier. Don't relay it to WineD3D */
static const DDDEVICEIDENTIFIER2 deviceidentifier = static const DDDEVICEIDENTIFIER2 deviceidentifier =
...@@ -684,11 +682,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface) ...@@ -684,11 +682,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
return DDERR_NOEXCLUSIVEMODE; 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; ddraw->flags &= ~DDRAW_RESTORE_MODE;
restore_mode = FALSE;
}
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -1097,10 +1092,6 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW ...@@ -1097,10 +1092,6 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
return DD_OK; 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) switch (bpp)
{ {
case 8: format = WINED3DFMT_P8_UINT; break; case 8: format = WINED3DFMT_P8_UINT; break;
...@@ -1121,10 +1112,7 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW ...@@ -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. */ * can't be changed if a surface is locked or some drawing is in progress. */
/* TODO: Lose the primary surface. */ /* TODO: Lose the primary surface. */
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode))) if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode)))
{
ddraw->flags |= DDRAW_RESTORE_MODE; ddraw->flags |= DDRAW_RESTORE_MODE;
restore_mode = TRUE;
}
wined3d_mutex_unlock(); wined3d_mutex_unlock();
......
...@@ -2410,13 +2410,13 @@ static void test_coop_level_mode_set(void) ...@@ -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); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; 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, && screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n", "Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r); 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, registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom); r.left, r.top, r.right, r.bottom);
...@@ -2584,7 +2584,7 @@ static void test_coop_level_mode_set(void) ...@@ -2584,7 +2584,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
...@@ -2740,7 +2740,7 @@ static void test_coop_level_mode_set(void) ...@@ -2740,7 +2740,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
......
...@@ -2616,13 +2616,13 @@ static void test_coop_level_mode_set(void) ...@@ -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); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; 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, && screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n", "Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r); 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, registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom); r.left, r.top, r.right, r.bottom);
...@@ -2790,7 +2790,7 @@ static void test_coop_level_mode_set(void) ...@@ -2790,7 +2790,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
...@@ -2946,7 +2946,7 @@ static void test_coop_level_mode_set(void) ...@@ -2946,7 +2946,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
......
...@@ -2803,13 +2803,13 @@ static void test_coop_level_mode_set(void) ...@@ -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); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; 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, && screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n", "Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r); 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, registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom); r.left, r.top, r.right, r.bottom);
...@@ -2970,7 +2970,7 @@ static void test_coop_level_mode_set(void) ...@@ -2970,7 +2970,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
...@@ -3126,7 +3126,7 @@ static void test_coop_level_mode_set(void) ...@@ -3126,7 +3126,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
......
...@@ -2480,13 +2480,13 @@ static void test_coop_level_mode_set(void) ...@@ -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); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; 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, && screen_size.cy == registry_mode.dmPelsHeight,
"Expected screen size %ux%u, got %ux%u.\n", "Expected screen size %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy);
GetWindowRect(window, &r); 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, registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom,
r.left, r.top, r.right, r.bottom); r.left, r.top, r.right, r.bottom);
...@@ -2647,7 +2647,7 @@ static void test_coop_level_mode_set(void) ...@@ -2647,7 +2647,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
...@@ -2803,7 +2803,7 @@ static void test_coop_level_mode_set(void) ...@@ -2803,7 +2803,7 @@ static void test_coop_level_mode_set(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n"); 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, && devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", "Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment