Commit 542590cf authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move IWineD3DDeviceImpl_SetupFullscreenWindow() to swapchain.c.

parent a9f2613d
......@@ -919,17 +919,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
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 LONG fullscreen_style(LONG orig_style) {
LONG style = orig_style;
style &= ~WS_CAPTION;
......@@ -951,38 +940,6 @@ static LONG fullscreen_exStyle(LONG orig_exStyle) {
return exStyle;
}
void IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDeviceImpl *This, HWND window, UINT w, UINT h)
{
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;
style = fullscreen_style(style);
exStyle = fullscreen_exStyle(exStyle);
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,
w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW);
}
/*****************************************************************************
* IWineD3DDeviceImpl_RestoreWindow
*
......@@ -6601,8 +6558,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
if(swapchain->win_handle && !pPresentationParameters->Windowed) {
if(swapchain->presentParms.Windowed) {
/* switch from windowed to fs */
IWineD3DDeviceImpl_SetupFullscreenWindow(This, swapchain->win_handle,
pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);
swapchain_setup_fullscreen_window(swapchain, pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight);
} else {
/* Fullscreen -> fullscreen mode change */
MoveWindow(swapchain->win_handle, 0, 0,
......@@ -6622,8 +6579,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
*/
This->style = 0;
This->exStyle = 0;
IWineD3DDeviceImpl_SetupFullscreenWindow(This, swapchain->win_handle,
pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);
swapchain_setup_fullscreen_window(swapchain, pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight);
This->style = style;
This->exStyle = exStyle;
}
......
......@@ -557,6 +557,51 @@ static const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
IWineD3DBaseSwapChainImpl_GetGammaRamp
};
static LONG fullscreen_style(LONG style)
{
/* Make sure the window is managed, otherwise we won't get keyboard input. */
style |= WS_POPUP | WS_SYSMENU;
style &= ~(WS_CAPTION | WS_THICKFRAME);
return style;
}
static LONG fullscreen_exstyle(LONG exstyle)
{
/* Filter out window decorations. */
exstyle &= ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
return exstyle;
}
void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h)
{
IWineD3DDeviceImpl *device = swapchain->device;
HWND window = swapchain->win_handle;
LONG style, exstyle;
TRACE("Setting up window %p for fullscreen mode.\n", window);
if (device->style || device->exStyle)
{
ERR("Changing the window style for window %p, but another style (%08x, %08x) is already stored.\n",
window, device->style, device->exStyle);
}
device->style = GetWindowLongW(window, GWL_STYLE);
device->exStyle = GetWindowLongW(window, GWL_EXSTYLE);
style = fullscreen_style(device->style);
exstyle = fullscreen_exstyle(device->exStyle);
TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n",
device->style, device->exStyle, style, exstyle);
SetWindowLongW(window, GWL_STYLE, style);
SetWindowLongW(window, GWL_EXSTYLE, exstyle);
SetWindowPos(window, HWND_TOP, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW);
}
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent)
{
......@@ -606,7 +651,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
if (!present_parameters->Windowed && window)
{
IWineD3DDeviceImpl_SetupFullscreenWindow(device, window, present_parameters->BackBufferWidth,
swapchain_setup_fullscreen_window(swapchain, present_parameters->BackBufferWidth,
present_parameters->BackBufferHeight);
}
......
......@@ -1598,7 +1598,6 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
const WINED3DRECT *pRects, DWORD Flags, WINED3DCOLOR Color, float Z, DWORD Stencil) DECLSPEC_HIDDEN;
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) DECLSPEC_HIDDEN;
void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) DECLSPEC_HIDDEN;
void IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDeviceImpl *This, HWND window, UINT w, UINT h) DECLSPEC_HIDDEN;
static inline BOOL isStateDirty(struct wined3d_context *context, DWORD state)
{
......@@ -2453,6 +2452,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface,
struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent) DECLSPEC_HIDDEN;
void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) DECLSPEC_HIDDEN;
#define DEFAULT_REFRESH_RATE 0
......
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