Commit 34b37fe2 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d: Remove IWineD3DDevice::SetHwnd.

parent 7f2b8f9b
...@@ -357,7 +357,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -357,7 +357,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
{ {
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface);
HWND window; HWND window;
HRESULT hr;
TRACE("(%p)->(%p,%08x)\n",This,hwnd,cooplevel); TRACE("(%p)->(%p,%08x)\n",This,hwnd,cooplevel);
DDRAW_dump_cooperativelevel(cooplevel); DDRAW_dump_cooperativelevel(cooplevel);
...@@ -365,13 +364,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -365,13 +364,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
/* Get the old window */ /* Get the old window */
hr = IWineD3DDevice_GetHWND(This->wineD3DDevice, &window); window = This->dest_window;
if(hr != D3D_OK)
{
ERR("IWineD3DDevice::GetHWND failed, hr = %08x\n", hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
/* Tests suggest that we need one of them: */ /* Tests suggest that we need one of them: */
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW | if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
...@@ -413,7 +406,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -413,7 +406,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
hwnd = NULL; hwnd = NULL;
/* Use the focus window for drawing too */ /* Use the focus window for drawing too */
IWineD3DDevice_SetHWND(This->wineD3DDevice, This->focuswindow); This->dest_window = This->focuswindow;
/* Destroy the device window, if we have one */ /* Destroy the device window, if we have one */
if(This->devicewindow) if(This->devicewindow)
...@@ -450,7 +443,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -450,7 +443,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
!(This->devicewindow) && !(This->devicewindow) &&
(hwnd != window) ) (hwnd != window) )
{ {
IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd); This->dest_window = hwnd;
} }
IWineD3DDevice_SetFullscreen(This->wineD3DDevice, IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
...@@ -483,7 +476,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -483,7 +476,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
!(This->devicewindow) && !(This->devicewindow) &&
(hwnd != window) ) (hwnd != window) )
{ {
IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd); This->dest_window = hwnd;
} }
} }
else if(cooplevel & DDSCL_EXCLUSIVE) else if(cooplevel & DDSCL_EXCLUSIVE)
...@@ -507,8 +500,8 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -507,8 +500,8 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */ ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */
TRACE("(%p) Created a DDraw device window. HWND=%p\n", This, devicewindow); TRACE("(%p) Created a DDraw device window. HWND=%p\n", This, devicewindow);
IWineD3DDevice_SetHWND(This->wineD3DDevice, devicewindow);
This->devicewindow = devicewindow; This->devicewindow = devicewindow;
This->dest_window = devicewindow;
} }
} }
...@@ -3195,11 +3188,7 @@ static HRESULT WINAPI IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *This, ...@@ -3195,11 +3188,7 @@ static HRESULT WINAPI IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *This,
WINED3DPRESENT_PARAMETERS presentation_parameters; WINED3DPRESENT_PARAMETERS presentation_parameters;
HWND window; HWND window;
hr = IWineD3DDevice_GetHWND(This->wineD3DDevice, window = This->dest_window;
&window);
if(FAILED(hr)) {
return hr;
}
memset(&presentation_parameters, 0, sizeof(presentation_parameters)); memset(&presentation_parameters, 0, sizeof(presentation_parameters));
...@@ -3253,21 +3242,12 @@ IDirectDrawImpl_AttachD3DDevice(IDirectDrawImpl *This, ...@@ -3253,21 +3242,12 @@ IDirectDrawImpl_AttachD3DDevice(IDirectDrawImpl *This,
IDirectDrawSurfaceImpl *primary) IDirectDrawSurfaceImpl *primary)
{ {
HRESULT hr; HRESULT hr;
HWND window; HWND window = This->dest_window;
WINED3DPRESENT_PARAMETERS localParameters; WINED3DPRESENT_PARAMETERS localParameters;
TRACE("(%p)->(%p)\n", This, primary); TRACE("(%p)->(%p)\n", This, primary);
/* Get the window */
hr = IWineD3DDevice_GetHWND(This->wineD3DDevice,
&window);
if(hr != D3D_OK)
{
ERR("IWineD3DDevice::GetHWND failed\n");
return hr;
}
/* If there's no window, create a hidden window. WineD3D needs it */ /* If there's no window, create a hidden window. WineD3D needs it */
if(window == 0) if(window == 0)
{ {
......
...@@ -137,6 +137,7 @@ struct IDirectDrawImpl ...@@ -137,6 +137,7 @@ struct IDirectDrawImpl
/* Various HWNDs */ /* Various HWNDs */
HWND focuswindow; HWND focuswindow;
HWND devicewindow; HWND devicewindow;
HWND dest_window;
/* The surface type to request */ /* The surface type to request */
WINED3DSURFTYPE ImplType; WINED3DSURFTYPE ImplType;
......
...@@ -1432,7 +1432,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic ...@@ -1432,7 +1432,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
if (!object->win_handle) { if (!object->win_handle) {
object->win_handle = This->createParms.hFocusWindow; object->win_handle = This->createParms.hFocusWindow;
} }
if(!This->ddraw_window) IWineD3DDevice_SetHWND(iface, object->win_handle); if(!This->ddraw_window) {
if(This->ddraw_fullscreen && object->win_handle) {
IWineD3DDeviceImpl_SetupFullscreenWindow(iface, object->win_handle);
}
This->ddraw_window = object->win_handle;
}
hDc = GetDC(object->win_handle); hDc = GetDC(object->win_handle);
TRACE("Using hDc %p\n", hDc); TRACE("Using hDc %p\n", hDc);
...@@ -4827,31 +4832,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, U ...@@ -4827,31 +4832,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, U
return hr; return hr;
} }
static HRESULT WINAPI IWineD3DDeviceImpl_SetHWND(IWineD3DDevice *iface, HWND hWnd) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p)->(%p)\n", This, hWnd);
if(This->ddraw_fullscreen) {
if(This->ddraw_window && This->ddraw_window != hWnd) {
IWineD3DDeviceImpl_RestoreWindow(iface, This->ddraw_window);
}
if(hWnd && This->ddraw_window != hWnd) {
IWineD3DDeviceImpl_SetupFullscreenWindow(iface, hWnd);
}
}
This->ddraw_window = hWnd;
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetHWND(IWineD3DDevice *iface, HWND *hWnd) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p)->(%p)\n", This, hWnd);
*hWnd = This->ddraw_window;
return WINED3D_OK;
}
/***** /*****
* Stateblock related functions * Stateblock related functions
*****/ *****/
...@@ -7734,8 +7714,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = ...@@ -7734,8 +7714,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_GetDirect3D, IWineD3DDeviceImpl_GetDirect3D,
IWineD3DDeviceImpl_GetDisplayMode, IWineD3DDeviceImpl_GetDisplayMode,
IWineD3DDeviceImpl_SetDisplayMode, IWineD3DDeviceImpl_SetDisplayMode,
IWineD3DDeviceImpl_GetHWND,
IWineD3DDeviceImpl_SetHWND,
IWineD3DDeviceImpl_GetNumberOfSwapChains, IWineD3DDeviceImpl_GetNumberOfSwapChains,
IWineD3DDeviceImpl_GetRasterStatus, IWineD3DDeviceImpl_GetRasterStatus,
IWineD3DDeviceImpl_GetSwapChain, IWineD3DDeviceImpl_GetSwapChain,
...@@ -7882,8 +7860,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_DirtyConst_Vtbl = ...@@ -7882,8 +7860,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_DirtyConst_Vtbl =
IWineD3DDeviceImpl_GetDirect3D, IWineD3DDeviceImpl_GetDirect3D,
IWineD3DDeviceImpl_GetDisplayMode, IWineD3DDeviceImpl_GetDisplayMode,
IWineD3DDeviceImpl_SetDisplayMode, IWineD3DDeviceImpl_SetDisplayMode,
IWineD3DDeviceImpl_GetHWND,
IWineD3DDeviceImpl_SetHWND,
IWineD3DDeviceImpl_GetNumberOfSwapChains, IWineD3DDeviceImpl_GetNumberOfSwapChains,
IWineD3DDeviceImpl_GetRasterStatus, IWineD3DDeviceImpl_GetRasterStatus,
IWineD3DDeviceImpl_GetSwapChain, IWineD3DDeviceImpl_GetSwapChain,
......
...@@ -387,8 +387,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) ...@@ -387,8 +387,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD(GetDirect3D)(THIS_ IWineD3D** ppD3D) PURE; STDMETHOD(GetDirect3D)(THIS_ IWineD3D** ppD3D) PURE;
STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain, WINED3DDISPLAYMODE* pMode) PURE; STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain, WINED3DDISPLAYMODE* pMode) PURE;
STDMETHOD(SetDisplayMode)(THIS_ UINT iSwapChain, WINED3DDISPLAYMODE* pMode) PURE; STDMETHOD(SetDisplayMode)(THIS_ UINT iSwapChain, WINED3DDISPLAYMODE* pMode) PURE;
STDMETHOD(GetHWND)(THIS_ HWND *hwnd) PURE;
STDMETHOD(SetHWND)(THIS_ HWND hwnd) PURE;
STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE;
STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain, WINED3DRASTER_STATUS* pRasterStatus) PURE; STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain, WINED3DRASTER_STATUS* pRasterStatus) PURE;
STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain, struct IWineD3DSwapChain **pSwapChain) PURE; STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain, struct IWineD3DSwapChain **pSwapChain) PURE;
...@@ -530,8 +528,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) ...@@ -530,8 +528,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
#define IWineD3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) #define IWineD3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a)
#define IWineD3DDevice_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) #define IWineD3DDevice_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
#define IWineD3DDevice_SetDisplayMode(p,a,b) (p)->lpVtbl->SetDisplayMode(p,a,b) #define IWineD3DDevice_SetDisplayMode(p,a,b) (p)->lpVtbl->SetDisplayMode(p,a,b)
#define IWineD3DDevice_GetHWND(p, a) (p)->lpVtbl->GetHWND(p, a)
#define IWineD3DDevice_SetHWND(p, a) (p)->lpVtbl->SetHWND(p, a)
#define IWineD3DDevice_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) #define IWineD3DDevice_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p)
#define IWineD3DDevice_Reset(p,a) (p)->lpVtbl->Reset(p,a) #define IWineD3DDevice_Reset(p,a) (p)->lpVtbl->Reset(p,a)
#define IWineD3DDevice_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) #define IWineD3DDevice_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a)
......
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