Author: greatlrd
Date: Thu Jun 14 17:41:48 2007
New Revision: 27173
URL:
http://svn.reactos.org/svn/reactos?rev=27173&view=rev
Log:
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.
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c Thu Jun 14 17:41:48
2007
@@ -17,11 +17,6 @@
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;
HWND window;
@@ -31,15 +26,26 @@
_SEH_TRY
{
- /* Get the old window */
- window = (HWND) This->lpLcl->hWnd;
-#if 0 // this check is totally invalid if you ask me - mbosma
- if(!window)
+ // FIXME test if 0x20 exists as a flag and what thuse it do
+ if ( ( cooplevel & (~(DDSCL_FPUPRESERVE | DDSCL_FPUSETUP |
DDSCL_MULTITHREADED | DDSCL_CREATEDEVICEWINDOW |
+ DDSCL_SETDEVICEWINDOW | DDSCL_SETFOCUSWINDOW |
DDSCL_ALLOWMODEX | DDSCL_EXCLUSIVE |
+ DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES | DDSCL_ALLOWREBOOT |
DDSCL_FULLSCREEN))) ||
+ (!( cooplevel & (DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_SETFOCUSWINDOW)))
||
+ ((cooplevel & DDSCL_FPUSETUP) && (cooplevel &
DDSCL_FPUPRESERVE)))
{
- retVal = DDERR_NOHWND;
- _SEH_LEAVE;
+ return DDERR_INVALIDPARAMS;
}
-#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))
{
@@ -47,34 +53,13 @@
_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 */
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;
_SEH_LEAVE;