Vitaliy Margolen : dinput: Use ClipCursor() to keep mouse from leaving the window.
Alexandre Julliard
julliard at winehq.org
Wed Oct 10 06:46:18 CDT 2007
Module: wine
Branch: master
Commit: 7e6d0e71ebf00e109055da7660c1043c2997b279
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7e6d0e71ebf00e109055da7660c1043c2997b279
Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date: Sun Oct 7 10:30:02 2007 -0600
dinput: Use ClipCursor() to keep mouse from leaving the window.
---
dlls/dinput/mouse.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 8edfe0e..214bbd8 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -410,7 +410,18 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
/* Install our mouse hook */
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
+ {
+ RECT rc;
+
ShowCursor(FALSE); /* hide cursor */
+ if (GetWindowRect(This->base.win, &rc))
+ {
+ FIXME("Clipping cursor to %s\n", wine_dbgstr_rect( &rc ));
+ ClipCursor(&rc);
+ }
+ else
+ ERR("Failed to get RECT: %d\n", GetLastError());
+ }
/* Get the window dimension and find the center */
GetWindowRect(This->base.win, &rect);
@@ -446,7 +457,10 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
if ((res = IDirectInputDevice2AImpl_Unacquire(iface)) != DI_OK) return res;
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
+ {
+ ClipCursor(NULL);
ShowCursor(TRUE); /* show cursor */
+ }
/* And put the mouse cursor back where it was at acquire time */
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
More information about the wine-cvs
mailing list