mirror of
https://github.com/reactos/reactos.git
synced 2025-01-10 00:00:20 +00:00
- outsourced DirectDraw_SetCooperativeLevel
- adjusted .c file headers svn path=/trunk/; revision=26734
This commit is contained in:
parent
9fb321d933
commit
a54fcea595
15 changed files with 215 additions and 198 deletions
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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,
|
||||
|
|
176
reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c
Normal file
176
reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c
Normal file
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
<directory name="Ddraw">
|
||||
<file>ddraw_stubs.c</file>
|
||||
<file>ddraw_setcooperativelevel.c</file>
|
||||
<file>ddraw_main.c</file>
|
||||
<file>callbacks_dd_hel.c</file>
|
||||
</directory>
|
||||
|
|
Loading…
Reference in a new issue