mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 01:11:35 +00:00
start rewrite SetCooperativeLevel
we pass some more test for setcooper but not all, the wine code are allot mess and wrong. the wine code will be remove complete. svn path=/trunk/; revision=27173
This commit is contained in:
parent
05105d3d12
commit
88bc96e3df
1 changed files with 20 additions and 35 deletions
|
@ -17,11 +17,6 @@ HRESULT WINAPI
|
||||||
Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel)
|
Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
* Code from wine, this functions have been cut and paste from wine 0.9.35
|
|
||||||
* and have been modify allot and are still in devloping so it match with
|
|
||||||
* msdn document struct and flags
|
|
||||||
*/
|
|
||||||
|
|
||||||
HRESULT retVal = DD_OK;
|
HRESULT retVal = DD_OK;
|
||||||
HWND window;
|
HWND window;
|
||||||
|
@ -31,15 +26,26 @@ Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD coopl
|
||||||
|
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
/* Get the old window */
|
// FIXME test if 0x20 exists as a flag and what thuse it do
|
||||||
window = (HWND) This->lpLcl->hWnd;
|
if ( ( cooplevel & (~(DDSCL_FPUPRESERVE | DDSCL_FPUSETUP | DDSCL_MULTITHREADED | DDSCL_CREATEDEVICEWINDOW |
|
||||||
#if 0 // this check is totally invalid if you ask me - mbosma
|
DDSCL_SETDEVICEWINDOW | DDSCL_SETFOCUSWINDOW | DDSCL_ALLOWMODEX | DDSCL_EXCLUSIVE |
|
||||||
if(!window)
|
DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN))) ||
|
||||||
|
(!( cooplevel & (DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_SETFOCUSWINDOW))) ||
|
||||||
|
((cooplevel & DDSCL_FPUSETUP) && (cooplevel & DDSCL_FPUPRESERVE)))
|
||||||
{
|
{
|
||||||
retVal = DDERR_NOHWND;
|
return DDERR_INVALIDPARAMS;
|
||||||
_SEH_LEAVE;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Code from wine, this functions have been cut and paste from wine 0.9.35
|
||||||
|
* and have been modify allot and are still in devloping so it match with
|
||||||
|
* msdn document struct and flags
|
||||||
|
*/
|
||||||
|
|
||||||
if(hwnd && !IsWindow(hwnd))
|
if(hwnd && !IsWindow(hwnd))
|
||||||
{
|
{
|
||||||
|
@ -47,34 +53,13 @@ Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD coopl
|
||||||
_SEH_LEAVE;
|
_SEH_LEAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tests suggest that we need one of them: */
|
|
||||||
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
|
|
||||||
DDSCL_NORMAL |
|
|
||||||
DDSCL_EXCLUSIVE )))
|
|
||||||
{
|
|
||||||
retVal = DDERR_INVALIDPARAMS;
|
|
||||||
_SEH_LEAVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle those levels first which set various hwnds */
|
/* Handle those levels first which set various hwnds */
|
||||||
if(cooplevel & DDSCL_SETFOCUSWINDOW)
|
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 ) )
|
|
||||||
{
|
|
||||||
retVal = DDERR_INVALIDPARAMS;
|
|
||||||
_SEH_LEAVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)
|
|
||||||
|
if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)
|
||||||
{
|
{
|
||||||
retVal = DDERR_HWNDALREADYSET;
|
retVal = DDERR_HWNDALREADYSET;
|
||||||
_SEH_LEAVE;
|
_SEH_LEAVE;
|
||||||
|
|
Loading…
Reference in a new issue