Commit 61125221 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Move SetupFullscreenWindow() and RestoreWindow() from IDirectDrawImpl…

wined3d: Move SetupFullscreenWindow() and RestoreWindow() from IDirectDrawImpl to IWineD3DDeviceImpl.
parent a31f2fd9
...@@ -301,99 +301,6 @@ IDirectDrawImpl_Release(IDirectDraw7 *iface) ...@@ -301,99 +301,6 @@ IDirectDrawImpl_Release(IDirectDraw7 *iface)
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* IDirectDrawImpl_SetupExclusiveWindow
*
* Helper function that modifies a HWND's Style and ExStyle for proper
* fullscreen use.
*
* Params:
* This: Pointer to the DirectDraw implementation
* HWND: Window to setup
*
*****************************************************************************/
static void
IDirectDrawImpl_SetupFullscreenWindow(IDirectDrawImpl *This,
HWND window)
{
LONG style, exStyle;
/* Don't do anything if an original style is stored.
* That shouldn't happen
*/
TRACE("(%p): Setting up window %p for exclusive mode\n", This, window);
if( (This->style != 0) && (This->exStyle != 0) )
{
ERR("(%p) Want to change the window parameters of HWND %p, but "
"another style is stored for restauration afterwards\n", This, window);
}
/* Get the parameters and save them */
style = GetWindowLongW(window, GWL_STYLE);
exStyle = GetWindowLongW(window, GWL_EXSTYLE);
This->style = style;
This->exStyle = exStyle;
/* Filter out window decorations */
style &= ~WS_CAPTION;
style &= ~WS_THICKFRAME;
exStyle &= ~WS_EX_WINDOWEDGE;
exStyle &= ~WS_EX_CLIENTEDGE;
/* Make sure the window is managed, otherwise we won't get keyboard input */
style |= WS_POPUP | WS_SYSMENU;
TRACE("Old style was %08x,%08x, setting to %08x,%08x\n",
This->style, This->exStyle, style, exStyle);
SetWindowLongW(window, GWL_STYLE, style);
SetWindowLongW(window, GWL_EXSTYLE, exStyle);
/* Inform the window about the update.
* TODO: Should I move it to 0/0 too?
*/
SetWindowPos(window, 0 /* InsertAfter, ignored */,
0, 0, 0, 0, /* Pos, Size, ignored */
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
}
/*****************************************************************************
* IDirectDrawImpl_RestoreWindow
*
* Helper function that restores a windows' properties when taking it out
* of fullscreen mode
*
* Params:
* This: Pointer to the DirectDraw implementation
* HWND: Window to setup
*
*****************************************************************************/
static void
IDirectDrawImpl_RestoreWindow(IDirectDrawImpl *This,
HWND window)
{
if( (This->style == 0) && (This->exStyle == 0) )
{
/* This could be a DDSCL_NORMAL -> DDSCL_NORMAL
* switch, do nothing
*/
return;
}
TRACE("(%p): Restoring window settings of window %p to %08x, %08x\n",
This, window, This->style, This->exStyle);
SetWindowLongW(window, GWL_STYLE, This->style);
SetWindowLongW(window, GWL_EXSTYLE, This->exStyle);
/* Delete the old values */
This->style = 0;
This->exStyle = 0;
/* Inform the window about the update */
SetWindowPos(window, 0 /* InsertAfter, ignored */,
0, 0, 0, 0, /* Pos, Size, ignored */
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
}
/*****************************************************************************
* IDirectDraw7::SetCooperativeLevel * IDirectDraw7::SetCooperativeLevel
* *
* Sets the cooperative level for the DirectDraw object, and the window * Sets the cooperative level for the DirectDraw object, and the window
...@@ -520,7 +427,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -520,7 +427,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
IDirectDraw7_RestoreDisplayMode(iface); IDirectDraw7_RestoreDisplayMode(iface);
if(window) if(window)
IDirectDrawImpl_RestoreWindow(This, window); IWineD3DDevice_RestoreWindow(This->wineD3DDevice, window);
This->cooperative_level &= ~DDSCL_FULLSCREEN; This->cooperative_level &= ~DDSCL_FULLSCREEN;
This->cooperative_level &= ~DDSCL_EXCLUSIVE; This->cooperative_level &= ~DDSCL_EXCLUSIVE;
...@@ -573,8 +480,8 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -573,8 +480,8 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
if(window != hwnd) if(window != hwnd)
{ {
if(window) if(window)
IDirectDrawImpl_RestoreWindow(This, window); IWineD3DDevice_RestoreWindow(This->wineD3DDevice, window);
IDirectDrawImpl_SetupFullscreenWindow(This, hwnd); IWineD3DDevice_SetupFullscreenWindow(This->wineD3DDevice, hwnd);
} }
IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd); IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd);
} }
......
...@@ -120,9 +120,6 @@ struct IDirectDrawImpl ...@@ -120,9 +120,6 @@ struct IDirectDrawImpl
DDCAPS caps; DDCAPS caps;
LONG style;
LONG exStyle;
/* D3D things */ /* D3D things */
IDirectDrawSurfaceImpl *d3d_target; IDirectDrawSurfaceImpl *d3d_target;
HWND d3d_window; HWND d3d_window;
......
...@@ -1252,6 +1252,91 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE ...@@ -1252,6 +1252,91 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
return WINED3D_OK; return WINED3D_OK;
} }
/*****************************************************************************
* IWineD3DDeviceImpl_SetupFullscreenWindow
*
* Helper function that modifies a HWND's Style and ExStyle for proper
* fullscreen use.
*
* Params:
* iface: Pointer to the IWineD3DDevice interface
* window: Window to setup
*
*****************************************************************************/
static void WINAPI IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDevice *iface, HWND window) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
LONG style, exStyle;
/* Don't do anything if an original style is stored.
* That shouldn't happen
*/
TRACE("(%p): Setting up window %p for exclusive mode\n", This, window);
if (This->style && This->exStyle) {
ERR("(%p): Want to change the window parameters of HWND %p, but "
"another style is stored for restoration afterwards\n", This, window);
}
/* Get the parameters and save them */
style = GetWindowLongW(window, GWL_STYLE);
exStyle = GetWindowLongW(window, GWL_EXSTYLE);
This->style = style;
This->exStyle = exStyle;
/* Filter out window decorations */
style &= ~WS_CAPTION;
style &= ~WS_THICKFRAME;
exStyle &= ~WS_EX_WINDOWEDGE;
exStyle &= ~WS_EX_CLIENTEDGE;
/* Make sure the window is managed, otherwise we won't get keyboard input */
style |= WS_POPUP | WS_SYSMENU;
TRACE("Old style was %08x,%08x, setting to %08x,%08x\n",
This->style, This->exStyle, style, exStyle);
SetWindowLongW(window, GWL_STYLE, style);
SetWindowLongW(window, GWL_EXSTYLE, exStyle);
/* Inform the window about the update. */
SetWindowPos(window, HWND_TOP, 0, 0,
This->ddraw_width, This->ddraw_height, SWP_FRAMECHANGED);
}
/*****************************************************************************
* IWineD3DDeviceImpl_RestoreWindow
*
* Helper function that restores a windows' properties when taking it out
* of fullscreen mode
*
* Params:
* iface: Pointer to the IWineD3DDevice interface
* window: Window to setup
*
*****************************************************************************/
static void WINAPI IWineD3DDeviceImpl_RestoreWindow(IWineD3DDevice *iface, HWND window) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* This could be a DDSCL_NORMAL -> DDSCL_NORMAL
* switch, do nothing
*/
if (!This->style && !This->exStyle) return;
TRACE("(%p): Restoring window settings of window %p to %08x, %08x\n",
This, window, This->style, This->exStyle);
SetWindowLongW(window, GWL_STYLE, This->style);
SetWindowLongW(window, GWL_EXSTYLE, This->exStyle);
/* Delete the old values */
This->style = 0;
This->exStyle = 0;
/* Inform the window about the update */
SetWindowPos(window, 0 /* InsertAfter, ignored */,
0, 0, 0, 0, /* Pos, Size, ignored */
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
}
/* example at http://www.fairyengine.com/articles/dxmultiviews.htm */ /* example at http://www.fairyengine.com/articles/dxmultiviews.htm */
static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, IWineD3DSwapChain** ppSwapChain, static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, IWineD3DSwapChain** ppSwapChain,
IUnknown* parent, IUnknown* parent,
...@@ -6759,6 +6844,8 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = ...@@ -6759,6 +6844,8 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_UpdateSurface, IWineD3DDeviceImpl_UpdateSurface,
IWineD3DDeviceImpl_GetRenderTargetData, IWineD3DDeviceImpl_GetRenderTargetData,
IWineD3DDeviceImpl_GetFrontBufferData, IWineD3DDeviceImpl_GetFrontBufferData,
IWineD3DDeviceImpl_SetupFullscreenWindow,
IWineD3DDeviceImpl_RestoreWindow,
/*** object tracking ***/ /*** object tracking ***/
IWineD3DDeviceImpl_ResourceReleased IWineD3DDeviceImpl_ResourceReleased
}; };
......
...@@ -560,6 +560,10 @@ typedef struct IWineD3DDeviceImpl ...@@ -560,6 +560,10 @@ typedef struct IWineD3DDeviceImpl
IUnknown *parent; IUnknown *parent;
IWineD3D *wineD3D; IWineD3D *wineD3D;
/* Window styles to restore when switching fullscreen mode */
LONG style;
LONG exStyle;
/* X and GL Information */ /* X and GL Information */
GLint maxConcurrentLights; GLint maxConcurrentLights;
......
...@@ -471,6 +471,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) ...@@ -471,6 +471,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD(UpdateSurface)(THIS_ struct IWineD3DSurface* pSourceSurface, CONST RECT* pSourceRect, struct IWineD3DSurface* pDestinationSurface, CONST POINT* pDestPoint) PURE; STDMETHOD(UpdateSurface)(THIS_ struct IWineD3DSurface* pSourceSurface, CONST RECT* pSourceRect, struct IWineD3DSurface* pDestinationSurface, CONST POINT* pDestPoint) PURE;
STDMETHOD(GetRenderTargetData)(THIS_ struct IWineD3DSurface* pRenderTarget, struct IWineD3DSurface* pSurface) PURE; STDMETHOD(GetRenderTargetData)(THIS_ struct IWineD3DSurface* pRenderTarget, struct IWineD3DSurface* pSurface) PURE;
STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,struct IWineD3DSurface* pSurface) PURE; STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,struct IWineD3DSurface* pSurface) PURE;
STDMETHOD_(void, SetupFullscreenWindow)(THIS_ HWND window) PURE;
STDMETHOD_(void, RestoreWindow)(THIS_ HWND window) PURE;
/*** object tracking ***/ /*** object tracking ***/
STDMETHOD_(void, ResourceReleased)(THIS_ struct IWineD3DResource *resource); STDMETHOD_(void, ResourceReleased)(THIS_ struct IWineD3DResource *resource);
}; };
...@@ -609,6 +611,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) ...@@ -609,6 +611,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
#define IWineD3DDevice_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) #define IWineD3DDevice_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d)
#define IWineD3DDevice_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) #define IWineD3DDevice_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b)
#define IWineD3DDevice_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) #define IWineD3DDevice_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
#define IWineD3DDevice_SetupFullscreenWindow(p, a) (p)->lpVtbl->SetupFullscreenWindow(p,a);
#define IWineD3DDevice_RestoreWindow(p, a) (p)->lpVtbl->RestoreWindow(p,a);
#define IWineD3DDevice_ResourceReleased(p,a) (p)->lpVtbl->ResourceReleased(p,a) #define IWineD3DDevice_ResourceReleased(p,a) (p)->lpVtbl->ResourceReleased(p,a)
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment