ddraw: Do not restore the display mode from inside SetCooperativeLevel (resend)
Johan Gill
johan.gill at gmail.com
Thu Apr 15 07:23:50 CDT 2010
-------------- next part --------------
dlls/ddraw/ddraw.c | 3 ---
dlls/ddraw/tests/ddrawmodes.c | 25 +++++++++++++++++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 0a6781c..3b64f31 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -441,9 +441,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
/* Switching from fullscreen? */
if(This->cooperative_level & DDSCL_FULLSCREEN)
{
- /* Restore the display mode */
- IDirectDraw7_RestoreDisplayMode(iface);
-
This->cooperative_level &= ~DDSCL_FULLSCREEN;
This->cooperative_level &= ~DDSCL_EXCLUSIVE;
This->cooperative_level &= ~DDSCL_ALLOWMODEX;
diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c
index 59f668b..8804618 100644
--- a/dlls/ddraw/tests/ddrawmodes.c
+++ b/dlls/ddraw/tests/ddrawmodes.c
@@ -414,11 +414,36 @@ static void setdisplaymode(int i)
scrn.right, scrn.bottom, virt.left, virt.top, virt.right, virt.bottom);
if (!EqualRect(&scrn, &orig_rect))
{
+ HRESULT rect_result;
+
/* Check that the client rect was resized */
rc = GetClientRect(hwnd, &test);
ok(rc!=0, "GetClientRect returned %x\n", rc);
rc = EqualRect(&scrn, &test);
todo_wine ok(rc!=0, "Fullscreen window has wrong size\n");
+
+ /* Check that switching to normal cooperative level
+ does not restore the display mode */
+ rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_NORMAL);
+ ok(rc==DD_OK, "SetCooperativeLevel returned %x\n", rc);
+ SetRect(&test, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+ rect_result = EqualRect(&scrn, &test);
+ ok(rect_result!=0, "Setting cooperative level to DDSCL_NORMAL changed the display mode\n");
+
+ /* Go back to fullscreen */
+ rc = IDirectDraw_SetCooperativeLevel(lpDD,
+ hwnd, DDSCL_ALLOWMODEX | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+ ok(rc==DD_OK, "SetCooperativeLevel returned: %x\n",rc);
+
+ /* If the display mode was changed, set the correct mode
+ to avoid irrelevant failures */
+ if (rect_result == 0)
+ {
+ rc = IDirectDraw_SetDisplayMode(lpDD,
+ modes[i].dwWidth, modes[i].dwHeight,
+ U1(modes[i].ddpfPixelFormat).dwRGBBitCount);
+ ok(DD_OK==rc, "SetDisplayMode returned: %x\n",rc);
+ }
}
ok(GetClipCursor(&r), "GetClipCursor() failed\n");
/* ddraw sets clip rect here to the screen size, even for
--
1.6.4
More information about the wine-patches
mailing list