Commit 388499ff authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: More fullscreen window fixes.

parent 7f5dccb6
...@@ -426,9 +426,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -426,9 +426,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
/* Restore the display mode */ /* Restore the display mode */
IDirectDraw7_RestoreDisplayMode(iface); IDirectDraw7_RestoreDisplayMode(iface);
if(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;
This->cooperative_level &= ~DDSCL_ALLOWMODEX; This->cooperative_level &= ~DDSCL_ALLOWMODEX;
...@@ -476,13 +473,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface, ...@@ -476,13 +473,6 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
!(This->devicewindow) && !(This->devicewindow) &&
(hwnd != window) ) (hwnd != window) )
{ {
/* On a window change, restore the old window and set the new one */
if(window != hwnd)
{
if(window)
IWineD3DDevice_RestoreWindow(This->wineD3DDevice, window);
IWineD3DDevice_SetupFullscreenWindow(This->wineD3DDevice, hwnd);
}
IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd); IWineD3DDevice_SetHWND(This->wineD3DDevice, hwnd);
} }
} }
......
...@@ -1159,7 +1159,7 @@ static void WINAPI IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDevice *ifac ...@@ -1159,7 +1159,7 @@ static void WINAPI IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDevice *ifac
* That shouldn't happen * That shouldn't happen
*/ */
TRACE("(%p): Setting up window %p for exclusive mode\n", This, window); TRACE("(%p): Setting up window %p for exclusive mode\n", This, window);
if (This->style && This->exStyle) { if (This->style || This->exStyle) {
ERR("(%p): Want to change the window parameters of HWND %p, but " ERR("(%p): Want to change the window parameters of HWND %p, but "
"another style is stored for restoration afterwards\n", This, window); "another style is stored for restoration afterwards\n", This, window);
} }
...@@ -1404,7 +1404,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic ...@@ -1404,7 +1404,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
This->ddraw_height = devmode.dmPelsHeight; This->ddraw_height = devmode.dmPelsHeight;
This->ddraw_format = *(pPresentationParameters->BackBufferFormat); This->ddraw_format = *(pPresentationParameters->BackBufferFormat);
IWineD3DDeviceImpl_SetupFullscreenWindow(iface, object->win_handle); IWineD3DDevice_SetFullscreen(iface, TRUE);
/* And finally clip mouse to our screen */ /* And finally clip mouse to our screen */
SetRect(&clip_rc, 0, 0, devmode.dmPelsWidth, devmode.dmPelsHeight); SetRect(&clip_rc, 0, 0, devmode.dmPelsWidth, devmode.dmPelsHeight);
...@@ -1681,6 +1681,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR ...@@ -1681,6 +1681,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
} }
This->swapchains[0] = (IWineD3DSwapChain *) swapchain; This->swapchains[0] = (IWineD3DSwapChain *) swapchain;
if(!This->ddraw_window) IWineD3DDevice_SetHWND(iface, swapchain->win_handle);
if(swapchain->backBuffer && swapchain->backBuffer[0]) { if(swapchain->backBuffer && swapchain->backBuffer[0]) {
TRACE("Setting rendertarget to %p\n", swapchain->backBuffer); TRACE("Setting rendertarget to %p\n", swapchain->backBuffer);
This->render_targets[0] = swapchain->backBuffer[0]; This->render_targets[0] = swapchain->backBuffer[0];
...@@ -1810,6 +1812,13 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL ...@@ -1810,6 +1812,13 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
TRACE("(%p) Setting DDraw fullscreen mode to %s\n", This, fullscreen ? "true" : "false"); TRACE("(%p) Setting DDraw fullscreen mode to %s\n", This, fullscreen ? "true" : "false");
/* Setup the window for fullscreen mode */
if(fullscreen && !This->ddraw_fullscreen) {
IWineD3DDeviceImpl_SetupFullscreenWindow(iface, This->ddraw_window);
} else if(!fullscreen && This->ddraw_fullscreen) {
IWineD3DDeviceImpl_RestoreWindow(iface, This->ddraw_window);
}
/* DirectDraw apps can change between fullscreen and windowed mode after device creation with /* DirectDraw apps can change between fullscreen and windowed mode after device creation with
* IDirectDraw7::SetCooperativeLevel. The GDI surface implementation needs to know this. * IDirectDraw7::SetCooperativeLevel. The GDI surface implementation needs to know this.
* DDraw doesn't necessarily have a swapchain, so we have to store the fullscreen flag * DDraw doesn't necessarily have a swapchain, so we have to store the fullscreen flag
...@@ -4006,6 +4015,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetHWND(IWineD3DDevice *iface, HWND hWn ...@@ -4006,6 +4015,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetHWND(IWineD3DDevice *iface, HWND hWn
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p)->(%p)\n", This, hWnd); 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; This->ddraw_window = hWnd;
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -5455,7 +5473,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE ...@@ -5455,7 +5473,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
if((*pPresentationParameters->Windowed && !swapchain->presentParms.Windowed) || if((*pPresentationParameters->Windowed && !swapchain->presentParms.Windowed) ||
(swapchain->presentParms.Windowed && !*pPresentationParameters->Windowed) || (swapchain->presentParms.Windowed && !*pPresentationParameters->Windowed) ||
DisplayModeChanged) { DisplayModeChanged) {
/* Switching to fullscreen? Change to fullscreen mode, THEN change the screen res */
if(!(*pPresentationParameters->Windowed)) {
IWineD3DDevice_SetFullscreen(iface, TRUE);
}
IWineD3DDevice_SetDisplayMode(iface, 0, &mode); IWineD3DDevice_SetDisplayMode(iface, 0, &mode);
/* Switching out of fullscreen mode? First set the original res, then change the window */
if(*pPresentationParameters->Windowed) {
IWineD3DDevice_SetFullscreen(iface, FALSE);
}
swapchain->presentParms.Windowed = *pPresentationParameters->Windowed;
} }
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
...@@ -5809,8 +5839,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = ...@@ -5809,8 +5839,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_UpdateTexture, IWineD3DDeviceImpl_UpdateTexture,
IWineD3DDeviceImpl_UpdateSurface, IWineD3DDeviceImpl_UpdateSurface,
IWineD3DDeviceImpl_GetFrontBufferData, IWineD3DDeviceImpl_GetFrontBufferData,
IWineD3DDeviceImpl_SetupFullscreenWindow,
IWineD3DDeviceImpl_RestoreWindow,
/*** object tracking ***/ /*** object tracking ***/
IWineD3DDeviceImpl_ResourceReleased IWineD3DDeviceImpl_ResourceReleased
}; };
......
...@@ -470,8 +470,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) ...@@ -470,8 +470,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD(UpdateTexture)(THIS_ struct IWineD3DBaseTexture *pSourceTexture, struct IWineD3DBaseTexture *pDestinationTexture) PURE; STDMETHOD(UpdateTexture)(THIS_ struct IWineD3DBaseTexture *pSourceTexture, struct IWineD3DBaseTexture *pDestinationTexture) PURE;
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(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,8 +607,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase) ...@@ -609,8 +607,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
#define IWineD3DDevice_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) #define IWineD3DDevice_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b)
#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_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