diff --git a/reactos/dll/directx/ddraw/Clipper/clipper_stubs.c b/reactos/dll/directx/ddraw/Clipper/clipper_stubs.c index 076d1fd32e1..98e94c87afe 100644 --- a/reactos/dll/directx/ddraw/Clipper/clipper_stubs.c +++ b/reactos/dll/directx/ddraw/Clipper/clipper_stubs.c @@ -1,8 +1,8 @@ /* $Id: clipper.c 24690 2006-11-05 21:19:53Z greatlrd $ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/clipper.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/clipper/clipper_stubs.c * PURPOSE: IDirectDrawClipper Implementation * PROGRAMMER: Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Color/color_stubs.c b/reactos/dll/directx/ddraw/Color/color_stubs.c index 92a00f2c653..31113fc11fb 100644 --- a/reactos/dll/directx/ddraw/Color/color_stubs.c +++ b/reactos/dll/directx/ddraw/Color/color_stubs.c @@ -1,8 +1,8 @@ /* $Id: color.c 24690 2006-11-05 21:19:53Z greatlrd $ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/color.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/color/color.c * PURPOSE: IDirectDrawColorControl Implementation * PROGRAMMER: Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c b/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c index 2a5017f4f1c..2069ffd5abe 100644 --- a/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c +++ b/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c @@ -1,9 +1,9 @@ -/* $Id: surface_hel.c 21519 2006-04-08 21:05:49Z greatlrd $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/soft/surface.c - * PURPOSE: DirectDraw Software Implementation + * PROJECT: ReactOS DirectX + * FILE: ddraw/ddraw/callbacks_dd_hel.c + * PURPOSE: HEL Callbacks for Direct Draw * PROGRAMMER: Magnus Olsen * */ diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c index 0b2f194d650..093afd9deb1 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c @@ -1,8 +1,8 @@ /* $Id$ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/ddraw.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/ddraw/ddraw_main.c * PURPOSE: IDirectDraw7 Implementation * PROGRAMMER: Magnus Olsen, Maarten Bosma * @@ -172,174 +172,6 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE return ret; } -/* - */ -HRESULT WINAPI -Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel) -{ - DX_WINDBG_trace(); - -/* - * 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 - */ - - HWND window; - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; - - /* Get the old window */ - window = (HWND) This->lpLcl->hWnd; -#if 0 // this check is totally invalid if you ask me - mbosma - if(!window) - { - return DDERR_NOHWND; - } -#endif - - /* Tests suggest that we need one of them: */ - if(!(cooplevel & (DDSCL_SETFOCUSWINDOW | - DDSCL_NORMAL | - DDSCL_EXCLUSIVE ))) - { - return DDERR_INVALIDPARAMS; - } - - /* 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 ) ) - { - return DDERR_INVALIDPARAMS; - } - - else if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED) - { - return DDERR_HWNDALREADYSET; - } - else if( (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN) && window) - { - return DDERR_HWNDALREADYSET; - } - - 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) ) - return DDERR_INVALIDPARAMS; - - - /* 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) ) - return DDERR_INVALIDPARAMS; - - /* 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) - { - return DDERR_INVALIDPARAMS; - } - - 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; - */ - - return DD_OK; - -} - IDirectDraw7Vtbl DirectDraw7_Vtable = { Main_DirectDraw_QueryInterface, diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c new file mode 100644 index 00000000000..be767b449d0 --- /dev/null +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c @@ -0,0 +1,176 @@ +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS DirectX + * FILE: ddraw/ddraw/ddraw_main.c + * PURPOSE: IDirectDraw7::SetCooperativeLevel Implementation + * PROGRAMMER: Magnus Olsen + * + */ + +#include "rosdraw.h" + +HRESULT WINAPI +Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hwnd, DWORD cooplevel) +{ + DX_WINDBG_trace(); + +/* + * 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 + */ + + HWND window; + LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; + + /* Get the old window */ + window = (HWND) This->lpLcl->hWnd; +#if 0 // this check is totally invalid if you ask me - mbosma + if(!window) + { + return DDERR_NOHWND; + } +#endif + + /* Tests suggest that we need one of them: */ + if(!(cooplevel & (DDSCL_SETFOCUSWINDOW | + DDSCL_NORMAL | + DDSCL_EXCLUSIVE ))) + { + return DDERR_INVALIDPARAMS; + } + + /* 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 ) ) + { + return DDERR_INVALIDPARAMS; + } + + else if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED) + { + return DDERR_HWNDALREADYSET; + } + else if( (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN) && window) + { + return DDERR_HWNDALREADYSET; + } + + 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) ) + return DDERR_INVALIDPARAMS; + + + /* 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) ) + return DDERR_INVALIDPARAMS; + + /* 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) + { + return DDERR_INVALIDPARAMS; + } + + 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; + */ + + return DD_OK; +} diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c index cae411dc9d4..246b0c4f925 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c @@ -1,8 +1,8 @@ /* $Id$ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: ddraw\ddraw\ddraw_stubs.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/ddraw/ddraw_stubs.c * PURPOSE: IDirectDraw7 Implementation * PROGRAMMER: Magnus Olsen, Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Gamma/gamma_stubs.c b/reactos/dll/directx/ddraw/Gamma/gamma_stubs.c index 63ef4dbb998..abdc7f09449 100644 --- a/reactos/dll/directx/ddraw/Gamma/gamma_stubs.c +++ b/reactos/dll/directx/ddraw/Gamma/gamma_stubs.c @@ -1,8 +1,8 @@ /* $Id: gamma.c 24690 2006-11-05 21:19:53Z greatlrd $ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/gamma.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/gamma/gamma_stubs.c * PURPOSE: IDirectDrawGamma Implementation * PROGRAMMER: Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Kernel/kernel_stubs.c b/reactos/dll/directx/ddraw/Kernel/kernel_stubs.c index 9506939192f..e5f0563924d 100644 --- a/reactos/dll/directx/ddraw/Kernel/kernel_stubs.c +++ b/reactos/dll/directx/ddraw/Kernel/kernel_stubs.c @@ -1,8 +1,8 @@ /* $Id: kernel.c 24690 2006-11-05 21:19:53Z greatlrd $ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/kernel.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/kernel/kernel_stubs.c * PURPOSE: IDirectDrawKernel and IDirectDrawSurfaceKernel Implementation * PROGRAMMER: Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Palette/palette_stubs.c b/reactos/dll/directx/ddraw/Palette/palette_stubs.c index 5f654c060f7..fe6a81ef813 100644 --- a/reactos/dll/directx/ddraw/Palette/palette_stubs.c +++ b/reactos/dll/directx/ddraw/Palette/palette_stubs.c @@ -1,8 +1,8 @@ /* $Id: palette.c 24690 2006-11-05 21:19:53Z greatlrd $ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/palette.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/palette/palette_stubs.c * PURPOSE: IDirectDrawPalette Implementation * PROGRAMMER: Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c b/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c index 00d0d0dd903..2f0b186a4b1 100644 --- a/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c +++ b/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c @@ -1,10 +1,10 @@ -/* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: lib/ddraw/ddraw.c - * PURPOSE: DirectDraw Library - * PROGRAMMER: Magnus Olsen (greatlrd) + * PROJECT: ReactOS DirectX + * FILE: ddraw/surface/callbacks_surf_hel.c + * PURPOSE: HEL Callbacks For Surface APIs + * PROGRAMMER: Magnus Olsen * */ diff --git a/reactos/dll/directx/ddraw/Surface/createsurface.c b/reactos/dll/directx/ddraw/Surface/createsurface.c index 65dc9137f54..eb6a5bd5e8a 100644 --- a/reactos/dll/directx/ddraw/Surface/createsurface.c +++ b/reactos/dll/directx/ddraw/Surface/createsurface.c @@ -1,4 +1,12 @@ - +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS DirectX + * FILE: ddraw/surface/createsurface.c + * PURPOSE: IDirectDrawSurface7 Creation + * PROGRAMMER: Magnus Olsen + * + */ #include "rosdraw.h" diff --git a/reactos/dll/directx/ddraw/Surface/surface_main.c b/reactos/dll/directx/ddraw/Surface/surface_main.c index 44d836c4038..cc3fd934cf5 100644 --- a/reactos/dll/directx/ddraw/Surface/surface_main.c +++ b/reactos/dll/directx/ddraw/Surface/surface_main.c @@ -1,8 +1,8 @@ /* $Id$ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/ + * PROJECT: ReactOS DirectX + * FILE: ddraw/surface/surface_main.c * PURPOSE: IDirectDrawSurface7 Implementation * PROGRAMMER: Magnus Olsen, Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Surface/surface_stubs.c b/reactos/dll/directx/ddraw/Surface/surface_stubs.c index 31144f39a96..36805ea9472 100644 --- a/reactos/dll/directx/ddraw/Surface/surface_stubs.c +++ b/reactos/dll/directx/ddraw/Surface/surface_stubs.c @@ -1,8 +1,8 @@ /* $Id$ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: + * PROJECT: ReactOS DirectX + * FILE: ddraw/surface/surface_stubs.c * PURPOSE: IDirectDrawSurface7 Implementation * PROGRAMMER: Magnus Olsen, Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/Videoport/videoport_stubs.c b/reactos/dll/directx/ddraw/Videoport/videoport_stubs.c index db8997e26ac..620ebf34579 100644 --- a/reactos/dll/directx/ddraw/Videoport/videoport_stubs.c +++ b/reactos/dll/directx/ddraw/Videoport/videoport_stubs.c @@ -1,8 +1,8 @@ /* $Id: videoport.c 22739 2006-07-01 12:08:35Z greatlrd $ * * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/videoport.c + * PROJECT: ReactOS DirectX + * FILE: ddraw/videoport/videoport_stubs.c * PURPOSE: IDirectDrawVideoPort, DDVideoPortContainer and IDirectDrawVideoPortNotify Implementation * PROGRAMMER: Maarten Bosma * diff --git a/reactos/dll/directx/ddraw/ddraw.rbuild b/reactos/dll/directx/ddraw/ddraw.rbuild index 78f79a338cd..480d836b29d 100644 --- a/reactos/dll/directx/ddraw/ddraw.rbuild +++ b/reactos/dll/directx/ddraw/ddraw.rbuild @@ -24,6 +24,7 @@ ddraw_stubs.c + ddraw_setcooperativelevel.c ddraw_main.c callbacks_dd_hel.c