ddraw: Only restore the display mode if we changed it.
This commit is contained in:
parent
40d3a34004
commit
bc3d767fda
|
@ -1064,6 +1064,10 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
|
|||
return DD_OK;
|
||||
}
|
||||
|
||||
if (!ddraw->restore_mode && FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d,
|
||||
WINED3DADAPTER_DEFAULT, &ddraw->original_mode, NULL)))
|
||||
ERR("Failed to get current display mode, hr %#x.\n", hr);
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 8: format = WINED3DFMT_P8_UINT; break;
|
||||
|
@ -1083,7 +1087,8 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
|
|||
/* TODO: The possible return values from msdn suggest that the screen mode
|
||||
* can't be changed if a surface is locked or some drawing is in progress. */
|
||||
/* TODO: Lose the primary surface. */
|
||||
hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode);
|
||||
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode)))
|
||||
ddraw->restore_mode = TRUE;
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -1155,13 +1160,20 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
|
|||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
if (!ddraw->restore_mode)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
if (exclusive_ddraw && exclusive_ddraw != ddraw)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
return DDERR_NOEXCLUSIVEMODE;
|
||||
}
|
||||
|
||||
hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &ddraw->original_mode);
|
||||
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &ddraw->original_mode)))
|
||||
ddraw->restore_mode = FALSE;
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -5371,14 +5383,6 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d,
|
||||
WINED3DADAPTER_DEFAULT, &ddraw->original_mode, NULL)))
|
||||
{
|
||||
ERR("Failed to get display mode, hr %#x.\n", hr);
|
||||
wined3d_decref(ddraw->wined3d);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = wined3d_device_create(ddraw->wined3d, WINED3DADAPTER_DEFAULT, device_type,
|
||||
NULL, 0, 8, &ddraw->device_parent, &ddraw->wined3d_device);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -68,7 +68,8 @@ struct ddraw
|
|||
|
||||
struct wined3d *wined3d;
|
||||
struct wined3d_device *wined3d_device;
|
||||
BOOL d3d_initialized;
|
||||
BOOL d3d_initialized;
|
||||
BOOL restore_mode;
|
||||
|
||||
struct ddraw_surface *primary;
|
||||
RECT primary_lock;
|
||||
|
|
Loading…
Reference in New Issue