Author: greatlrd
Date: Fri Jun 15 02:04:32 2007
New Revision: 27181
URL:
http://svn.reactos.org/svn/reactos?rev=27181&view=rev
Log:
more rewriting of setcooperlevel, it start working simluare as windows ddraw. and it start
setup same value as well in the private struct.
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Fri Jun 15 02:04:32 2007
@@ -161,7 +161,7 @@
_SEH_TRY
{
- if (This->lpLcl->lpGbl->lpExclusiveOwner == This->lpLcl)
+ if (This->lpLcl->lpGbl->lpExclusiveOwner != This->lpLcl)
{
retVal = DDERR_NOEXCLUSIVEMODE;
}
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 Fri Jun 15 02:04:32
2007
@@ -26,20 +26,121 @@
_SEH_TRY
{
+
+ if (hwnd && !IsWindow(hwnd))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
// FIXME test if 0x20 exists as a flag and what thuse it do
- if ( ( cooplevel & (~(DDSCL_FPUPRESERVE | DDSCL_FPUSETUP |
DDSCL_MULTITHREADED | DDSCL_CREATEDEVICEWINDOW |
+ 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)))
- {
- return DDERR_INVALIDPARAMS;
- }
-
-
-
-
-
+ DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES | DDSCL_ALLOWREBOOT |
DDSCL_FULLSCREEN)))
+ {
+
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if (!( cooplevel & (DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_SETFOCUSWINDOW)))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if ((cooplevel & DDSCL_FPUSETUP) && (cooplevel &
DDSCL_FPUPRESERVE))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if ((cooplevel & DDSCL_EXCLUSIVE) && (!(cooplevel &
DDSCL_FULLSCREEN)))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if ((cooplevel & DDSCL_ALLOWMODEX) && (!(cooplevel &
DDSCL_FULLSCREEN)))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if ((cooplevel & (DDSCL_CREATEDEVICEWINDOW | DDSCL_SETFOCUSWINDOW)))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if (!cooplevel)
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+
+ /* NORMAL MODE */
+ if(!(cooplevel & (~DDSCL_NORMAL)))
+ {
+ /* FIXME in setup.c set DDRAWI_UMODELOADED | DDRAWI_DISPLAYDRV |
DDRAWI_EMULATIONINITIALIZED | DDRAWI_GDIDRV | DDRAWI_ATTACHEDTODESKTOP */
+ /* FIXME in setup.c This->lpLcl->lpGbl->dwFlags = */
+
+ This->lpLcl->dwLocalFlags = DDRAWILCL_SETCOOPCALLED |
DDRAWILCL_DIRECTDRAW7 | DDRAWILCL_HOOKEDHWND;
+ This->lpLcl->hWnd = (ULONG_PTR) hwnd;
+ This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
+ This->lpLcl->lpGbl->lpExclusiveOwner=NULL;
+
+ retVal = DD_OK;
+ _SEH_LEAVE;
+ }
+
+ /* FULLSCREEN */
+ if ((!(cooplevel & (~(DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))) ||
+ (!(cooplevel & (~(DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN |
DDSCL_ALLOWMODEX)))))
+
+ {
+ /* FIXME in setup.c This->lpLcl->lpGbl->dwFlags = */
+
+ if (hwnd == NULL)
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if( (GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD) )
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if( (This->lpLcl->lpGbl->lpExclusiveOwner != NULL) &&
+ (This->lpLcl->lpGbl->lpExclusiveOwner != This->lpLcl) )
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ This->lpLcl->lpGbl->lpExclusiveOwner = This-> lpLcl;
+
+ This->lpLcl->dwLocalFlags = DDRAWILCL_SETCOOPCALLED |
DDRAWILCL_DIRECTDRAW7 | DDRAWILCL_HOOKEDHWND |
+ DDRAWILCL_HASEXCLUSIVEMODE |
DDRAWILCL_ISFULLSCREEN | DDRAWILCL_ACTIVEYES |
+ DDRAWILCL_CURSORCLIPPED;
+
+ if (cooplevel & DDSCL_ALLOWMODEX)
+ {
+ This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags |
DDRAWILCL_ALLOWMODEX;
+ }
+
+ This->lpLcl->hWnd = (ULONG_PTR) hwnd;
+ This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
+
+
+ /* FIXME fullscreen are not finuish */
+
+ retVal = DD_OK;
+ _SEH_LEAVE;
+ }
/*
* Code from wine, this functions have been cut and paste from wine 0.9.35
@@ -47,139 +148,134 @@
* msdn document struct and flags
*/
- if(hwnd && !IsWindow(hwnd))
- {
- retVal = DDERR_INVALIDPARAMS;
- _SEH_LEAVE;
- }
-
-
- /* Handle those levels first which set various hwnds */
- if(cooplevel & DDSCL_SETFOCUSWINDOW)
- {
-
-
- if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)
- {
- retVal = DDERR_HWNDALREADYSET;
- _SEH_LEAVE;
- }
- else if( (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN)
&& window)
- {
- retVal = DDERR_HWNDALREADYSET;
- _SEH_LEAVE;
- }
-
- This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
-
-
- /* Won't use the hwnd param for anything else */
- hwnd = NULL;
-
- /* Use the focus window for drawing too */
- This->lpLcl->hWnd = This->lpLcl->hFocusWnd;
-
- }
-
- /* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */
- if(cooplevel & DDSCL_NORMAL)
- {
- /* Can't coexist with fullscreen or exclusive */
- if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) )
- {
- retVal = DDERR_INVALIDPARAMS;
- _SEH_LEAVE;
- }
-
- /* Switching from fullscreen? */
- if(This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN)
- {
- /* Restore the display mode */
- Main_DirectDraw_RestoreDisplayMode(iface);
-
- This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ISFULLSCREEN;
- This->lpLcl->dwLocalFlags &= ~DDRAWILCL_HASEXCLUSIVEMODE;
- This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ALLOWMODEX;
- }
-
- /* Don't override focus windows or private device windows */
- if( hwnd &&
- !(This->lpLcl->hFocusWnd) &&
- !(This->lpLcl->dwObsolete1) &&
- (hwnd != window) )
- {
- This->lpLcl->hWnd = (ULONG_PTR)hwnd;
- }
-
- /* FIXME GL
- IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
- FALSE);
- */
- }
- else if(cooplevel & DDSCL_FULLSCREEN)
- {
- /* Needs DDSCL_EXCLUSIVE */
- if(!(cooplevel & DDSCL_EXCLUSIVE) )
- {
- retVal = DDERR_INVALIDPARAMS;
- _SEH_LEAVE;
- }
-
- /* Switch from normal to full screen mode? */
- if (!(This->lpLcl->dwLocalFlags & DDRAWILCL_HASEXCLUSIVEMODE))
- {
- /* FIXME GL
- IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
- TRUE);
- */
- }
-
- /* Don't override focus windows or private device windows */
- if( hwnd &&
- !(This->lpLcl->hFocusWnd) &&
- !(This->lpLcl->dwObsolete1) &&
- (hwnd != window) )
- {
- This->lpLcl->hWnd = (ULONG_PTR) hwnd;
- }
- }
- else if(cooplevel & DDSCL_EXCLUSIVE)
- {
- retVal = DDERR_INVALIDPARAMS;
- _SEH_LEAVE;
- }
-
- if(cooplevel & DDSCL_CREATEDEVICEWINDOW)
- {
- /* Don't create a device window if a focus window is set */
- if( !This->lpLcl->hFocusWnd)
- {
- HWND devicewindow = CreateWindowExW(0, classname, L"DDraw device
window",
- WS_POPUP, 0, 0,
- GetSystemMetrics(SM_CXSCREEN),
- GetSystemMetrics(SM_CYSCREEN),
- NULL, NULL, GetModuleHandleW(0), NULL);
-
- ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */
-
- This->lpLcl->dwObsolete1 = (DWORD)devicewindow;
- }
- }
-
- if(cooplevel & DDSCL_MULTITHREADED &&
!(This->lpLcl->dwLocalFlags & DDRAWILCL_MULTITHREADED))
- {
- /* FIXME GL
- * IWineD3DDevice_SetMultithreaded(This->wineD3DDevice);
- */
- }
-
-
-
- /* Store the cooperative_level */
-
- /* FIXME GL
- * This->cooperative_level |= cooplevel;
- */
+
+
+ ///* Handle those levels first which set various hwnds */
+ //if(cooplevel & DDSCL_SETFOCUSWINDOW)
+ //{
+ //
+
+ // if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)
+ // {
+ // retVal = DDERR_HWNDALREADYSET;
+ // _SEH_LEAVE;
+ // }
+ // else if( (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN)
&& window)
+ // {
+ // retVal = DDERR_HWNDALREADYSET;
+ // _SEH_LEAVE;
+ // }
+
+ // This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
+
+
+ // /* Won't use the hwnd param for anything else */
+ // hwnd = NULL;
+
+ // /* Use the focus window for drawing too */
+ // This->lpLcl->hWnd = This->lpLcl->hFocusWnd;
+
+ //}
+
+ ///* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */
+ //if(cooplevel & DDSCL_NORMAL)
+ //{
+ // /* Can't coexist with fullscreen or exclusive */
+ // if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) )
+ // {
+ // retVal = DDERR_INVALIDPARAMS;
+ // _SEH_LEAVE;
+ // }
+
+ // /* Switching from fullscreen? */
+ // if(This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN)
+ // {
+ // /* Restore the display mode */
+ // Main_DirectDraw_RestoreDisplayMode(iface);
+
+ // This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ISFULLSCREEN;
+ // This->lpLcl->dwLocalFlags &= ~DDRAWILCL_HASEXCLUSIVEMODE;
+ // This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ALLOWMODEX;
+ // }
+
+ // /* Don't override focus windows or private device windows */
+ // if( hwnd &&
+ // !(This->lpLcl->hFocusWnd) &&
+ // !(This->lpLcl->dwObsolete1) &&
+ // (hwnd != window) )
+ // {
+ // This->lpLcl->hWnd = (ULONG_PTR)hwnd;
+ // }
+
+ // /* FIXME GL
+ // IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
+ // FALSE);
+ // */
+ // }
+ // else if(cooplevel & DDSCL_FULLSCREEN)
+ // {
+ // /* Needs DDSCL_EXCLUSIVE */
+ // if(!(cooplevel & DDSCL_EXCLUSIVE) )
+ // {
+ // retVal = DDERR_INVALIDPARAMS;
+ // _SEH_LEAVE;
+ // }
+
+ // /* Switch from normal to full screen mode? */
+ // if (!(This->lpLcl->dwLocalFlags &
DDRAWILCL_HASEXCLUSIVEMODE))
+ // {
+ // /* FIXME GL
+ // IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
+ // TRUE);
+ // */
+ // }
+
+ // /* Don't override focus windows or private device windows */
+ // if( hwnd &&
+ // !(This->lpLcl->hFocusWnd) &&
+ // !(This->lpLcl->dwObsolete1) &&
+ // (hwnd != window) )
+ // {
+ // This->lpLcl->hWnd = (ULONG_PTR) hwnd;
+ // }
+ // }
+ // else if(cooplevel & DDSCL_EXCLUSIVE)
+ // {
+ // retVal = DDERR_INVALIDPARAMS;
+ // _SEH_LEAVE;
+ // }
+
+ // if(cooplevel & DDSCL_CREATEDEVICEWINDOW)
+ // {
+ // /* Don't create a device window if a focus window is set */
+ // if( !This->lpLcl->hFocusWnd)
+ // {
+ // HWND devicewindow = CreateWindowExW(0, classname, L"DDraw
device window",
+ // WS_POPUP, 0, 0,
+ // GetSystemMetrics(SM_CXSCREEN),
+ // GetSystemMetrics(SM_CYSCREEN),
+ // NULL, NULL, GetModuleHandleW(0),
NULL);
+
+ // ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */
+
+ // This->lpLcl->dwObsolete1 = (DWORD)devicewindow;
+ // }
+ // }
+
+ // if(cooplevel & DDSCL_MULTITHREADED &&
!(This->lpLcl->dwLocalFlags & DDRAWILCL_MULTITHREADED))
+ // {
+ // /* FIXME GL
+ // * IWineD3DDevice_SetMultithreaded(This->wineD3DDevice);
+ // */
+ // }
+
+
+
+ // /* Store the cooperative_level */
+
+ // /* FIXME GL
+ // * This->cooperative_level |= cooplevel;
+ // */
}
_SEH_HANDLE
{