wined3d: When changing display modes clip cursor to the requested display size.

oldstable
Vitaliy Margolen 2006-12-14 15:51:23 -07:00 committed by Alexandre Julliard
parent 4d8135e0c8
commit 2a63a03eb1
2 changed files with 26 additions and 1 deletions

View File

@ -146,7 +146,27 @@ static void setdisplaymode(int i)
modes[i].dwWidth, modes[i].dwHeight,
U1(modes[i].ddpfPixelFormat).dwRGBBitCount);
ok(DD_OK==rc || DDERR_UNSUPPORTED==rc,"SetDisplayMode returned: %x\n",rc);
if (DD_OK==rc) {
if (rc == DD_OK)
{
RECT r, scrn, virt;
SetRect(&virt, 0, 0, GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN));
OffsetRect(&virt, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN));
SetRect(&scrn, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
trace("Mode (%dx%d) [%dx%d] (%d %d)x(%d %d)\n", modes[i].dwWidth, modes[i].dwHeight,
scrn.right, scrn.bottom, virt.left, virt.top, virt.right, virt.bottom);
ok(GetClipCursor(&r), "GetClipCursor() failed\n");
/* ddraw sets clip rect here to the screen size, even for
multiple monitors */
ok(EqualRect(&r, &scrn), "Invalid clip rect: (%d %d) x (%d %d)\n",
r.left, r.top, r.right, r.bottom);
ok(ClipCursor(NULL), "ClipCursor() failed\n");
ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &virt), "Invalid clip rect: (%d %d) x (%d %d)\n",
r.left, r.top, r.right, r.bottom);
rc = IDirectDraw_RestoreDisplayMode(lpDD);
ok(DD_OK==rc,"RestoreDisplayMode returned: %x\n",rc);
}

View File

@ -2254,6 +2254,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
LONG ret;
const PixelFormatDesc *formatDesc = getFormatDescEntry(pMode->Format);
RECT clip_rc;
TRACE("(%p)->(%d,%p) Mode=%dx%dx@%d, %s\n", This, iSwapChain, pMode, pMode->Width, pMode->Height, pMode->RefreshRate, debug_d3dformat(pMode->Format));
@ -2304,6 +2305,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
if(This->ddraw_window)
MoveWindow(This->ddraw_window, 0, 0, pMode->Width, pMode->Height, TRUE);
/* And finally clip mouse to our screen */
SetRect(&clip_rc, 0, 0, pMode->Width, pMode->Height);
ClipCursor(&clip_rc);
return WINED3D_OK;
}