ddraw: SETFOCUSWINDOW lives independently of other flags.

oldstable
David Adam 2010-10-22 08:32:39 +02:00 committed by Alexandre Julliard
parent 1a7300b4b6
commit 0a90271d69
2 changed files with 21 additions and 10 deletions

View File

@ -586,21 +586,23 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
if(cooplevel & DDSCL_SETFOCUSWINDOW)
{
/* This isn't compatible with a lot of flags */
if(cooplevel & ( DDSCL_MULTITHREADED |
DDSCL_FPUSETUP |
DDSCL_FPUPRESERVE |
DDSCL_ALLOWREBOOT |
DDSCL_ALLOWMODEX |
DDSCL_SETDEVICEWINDOW |
DDSCL_NORMAL |
DDSCL_EXCLUSIVE |
DDSCL_FULLSCREEN ) )
if(cooplevel & ( DDSCL_MULTITHREADED |
DDSCL_CREATEDEVICEWINDOW |
DDSCL_FPUSETUP |
DDSCL_FPUPRESERVE |
DDSCL_ALLOWREBOOT |
DDSCL_ALLOWMODEX |
DDSCL_SETDEVICEWINDOW |
DDSCL_NORMAL |
DDSCL_EXCLUSIVE |
DDSCL_FULLSCREEN ) )
{
TRACE("Called with incompatible flags, returning DDERR_INVALIDPARAMS\n");
LeaveCriticalSection(&ddraw_cs);
return DDERR_INVALIDPARAMS;
}
else if( (This->cooperative_level & DDSCL_FULLSCREEN) && window)
if( (This->cooperative_level & DDSCL_FULLSCREEN) && window )
{
TRACE("Setting DDSCL_SETFOCUSWINDOW with an already set window, returning DDERR_HWNDALREADYSET\n");
LeaveCriticalSection(&ddraw_cs);
@ -620,6 +622,8 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
DestroyWindow(This->devicewindow);
This->devicewindow = NULL;
}
return DD_OK;
}
/* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */
if(cooplevel & DDSCL_NORMAL)

View File

@ -557,6 +557,9 @@ static void testcooperativelevels_normal(void)
surfacedesc.dwBackBufferCount = 1;
surfacedesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW);
ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW) returned: %x\n",rc);
/* Do some tests with DDSCL_NORMAL mode */
/* Fullscreen mode + normal mode + exclusive mode */
rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL);
@ -604,6 +607,10 @@ static void testcooperativelevels_normal(void)
if(surface && surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface);
/* Set the focus window */
rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW);
ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW) returned: %x\n",rc);
rc = IDirectDraw_SetCooperativeLevel(lpDD,
hwnd, DDSCL_SETFOCUSWINDOW);