Start to implement TestCooperativeLevel.

This commit is contained in:
Oliver Stieber 2005-09-21 10:55:03 +00:00 committed by Alexandre Julliard
parent 5173234ea8
commit 329d017db3
3 changed files with 34 additions and 2 deletions

View File

@ -5844,8 +5844,27 @@ BOOL WINAPI IWineD3DDeviceImpl_ShowCursor(IWineD3DDevice* iface, BOOL bShow
HRESULT WINAPI IWineD3DDeviceImpl_TestCooperativeLevel(IWineD3DDevice* iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
FIXME("(%p) : stub\n", This); /* No way of notifying yet! */
return D3D_OK;
TRACE("(%p) : state (%lu)\n", This, This->state);
/* TODO: Implement wrapping of the WndProc so that mimimize and maxamise can be monitored and the states adjusted. */
switch (This->state) {
case D3D_OK:
return D3D_OK;
case D3DERR_DEVICELOST:
{
ResourceList *resourceList = This->resources;
while (NULL != resourceList) {
if (((IWineD3DResourceImpl *)resourceList->resource)->resource.pool == D3DPOOL_DEFAULT /* TODO: IWineD3DResource_GetPool(resourceList->resource)*/)
return D3DERR_DEVICENOTRESET;
resourceList = resourceList->next;
}
return D3DERR_DEVICELOST;
}
case D3DERR_DRIVERINTERNALERROR:
return D3DERR_DRIVERINTERNALERROR;
}
/* Unknown state */
return D3DERR_DRIVERINTERNALERROR;
}

View File

@ -1639,6 +1639,9 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
IWineD3D_AddRef(object->wineD3D);
object->parent = parent;
/* Set the state up as invalid until the device is fully created */
object->state = D3DERR_DRIVERINTERNALERROR;
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
@ -1736,8 +1739,15 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
}
/* set the state of the device to valid */
object->state = D3D_OK;
return D3D_OK;
create_device_error:
/* Set the device state to error */
object->state = D3DERR_DRIVERINTERNALERROR;
if (object->updateStateBlock != NULL) {
IWineD3DStateBlock_Release((IWineD3DStateBlock *)object->updateStateBlock);
object->updateStateBlock = NULL;

View File

@ -536,6 +536,9 @@ typedef struct IWineD3DDeviceImpl
/* Debug stream management */
BOOL debug;
/* Device state management */
HRESULT state;
/* Screen buffer resources */
glContext contextCache[CONTEXT_CACHE];