diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index d037769b1b1..6ae02698fca 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -357,7 +357,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, { ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, iface); HWND window; - HRESULT hr; TRACE("(%p)->(%p,%08x)\n",This,hwnd,cooplevel); DDRAW_dump_cooperativelevel(cooplevel); @@ -365,13 +364,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, EnterCriticalSection(&ddraw_cs); /* Get the old window */ - hr = IWineD3DDevice_GetHWND(This->wineD3DDevice, &window); - if(hr != D3D_OK) - { - ERR("IWineD3DDevice::GetHWND failed, hr = %08x\n", hr); - LeaveCriticalSection(&ddraw_cs); - return hr; - } + window = This->dest_window; /* Tests suggest that we need one of them: */ if(!(cooplevel & (DDSCL_SETFOCUSWINDOW | @@ -413,7 +406,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, hwnd = NULL; /* 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 */ if(This->devicewindow) @@ -450,7 +443,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, !(This->devicewindow) && (hwnd != window) ) { - IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd); + This->dest_window = hwnd; } IWineD3DDevice_SetFullscreen(This->wineD3DDevice, @@ -483,7 +476,7 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, !(This->devicewindow) && (hwnd != window) ) { - IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd); + This->dest_window = hwnd; } } else if(cooplevel & DDSCL_EXCLUSIVE) @@ -507,8 +500,8 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */ TRACE("(%p) Created a DDraw device window. HWND=%p\n", This, devicewindow); - IWineD3DDevice_SetHWND(This->wineD3DDevice, devicewindow); This->devicewindow = devicewindow; + This->dest_window = devicewindow; } } @@ -3195,11 +3188,7 @@ static HRESULT WINAPI IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *This, WINED3DPRESENT_PARAMETERS presentation_parameters; HWND window; - hr = IWineD3DDevice_GetHWND(This->wineD3DDevice, - &window); - if(FAILED(hr)) { - return hr; - } + window = This->dest_window; memset(&presentation_parameters, 0, sizeof(presentation_parameters)); @@ -3253,21 +3242,12 @@ IDirectDrawImpl_AttachD3DDevice(IDirectDrawImpl *This, IDirectDrawSurfaceImpl *primary) { HRESULT hr; - HWND window; + HWND window = This->dest_window; WINED3DPRESENT_PARAMETERS localParameters; 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(window == 0) { diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index b7816d7ab75..a92f7f4e3ef 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -137,6 +137,7 @@ struct IDirectDrawImpl /* Various HWNDs */ HWND focuswindow; HWND devicewindow; + HWND dest_window; /* The surface type to request */ WINED3DSURFTYPE ImplType; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index abcd90f035b..b89db16e050 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1432,7 +1432,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic if (!object->win_handle) { 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); TRACE("Using hDc %p\n", hDc); @@ -4827,31 +4832,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, U 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 *****/ @@ -7734,8 +7714,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_GetDirect3D, IWineD3DDeviceImpl_GetDisplayMode, IWineD3DDeviceImpl_SetDisplayMode, - IWineD3DDeviceImpl_GetHWND, - IWineD3DDeviceImpl_SetHWND, IWineD3DDeviceImpl_GetNumberOfSwapChains, IWineD3DDeviceImpl_GetRasterStatus, IWineD3DDeviceImpl_GetSwapChain, @@ -7882,8 +7860,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_DirtyConst_Vtbl = IWineD3DDeviceImpl_GetDirect3D, IWineD3DDeviceImpl_GetDisplayMode, IWineD3DDeviceImpl_SetDisplayMode, - IWineD3DDeviceImpl_GetHWND, - IWineD3DDeviceImpl_SetHWND, IWineD3DDeviceImpl_GetNumberOfSwapChains, IWineD3DDeviceImpl_GetRasterStatus, IWineD3DDeviceImpl_GetSwapChain, diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h index e8b4d94290b..72ee7fd39e2 100644 --- a/include/wine/wined3d_interface.h +++ b/include/wine/wined3d_interface.h @@ -387,8 +387,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) STDMETHOD(GetDirect3D)(THIS_ IWineD3D** ppD3D) PURE; STDMETHOD(GetDisplayMode)(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(GetRasterStatus)(THIS_ UINT iSwapChain, WINED3DRASTER_STATUS* pRasterStatus) PURE; STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain, struct IWineD3DSwapChain **pSwapChain) PURE; @@ -530,8 +528,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) #define IWineD3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) #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_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_Reset(p,a) (p)->lpVtbl->Reset(p,a) #define IWineD3DDevice_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a)