All pastes #89234 Raw Edit

Something

public text v1 · immutable
#89234 ·published 2006-07-16 00:19 UTC
rendered paste body
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 8bd395e..4df7a61 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -136,6 +136,7 @@ struct SysMouseImpl
     /* warping: whether we need to move mouse back to middle once we
      * reach window borders (for e.g. shooters, "surface movement" games) */
     WARP_STATUS		            need_warp;
+    DWORD                           last_warped;
     int				    acquired;
     HANDLE			    hEvent;
     CRITICAL_SECTION		    crit;
@@ -623,6 +624,8 @@ static HRESULT WINAPI SysMouseAImpl_Acqu
       MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
       TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
       SetCursorPos( This->mapped_center.x, This->mapped_center.y );
+      This->last_warped = GetCurrentTime();
+
 #ifdef MOUSE_HACK
       This->need_warp = WARP_DONE;
 #else
@@ -698,11 +701,12 @@ static HRESULT WINAPI SysMouseAImpl_GetD
     }
     
     /* Check if we need to do a mouse warping */
-    if (This->need_warp == WARP_NEEDED) {
+    if (This->need_warp == WARP_NEEDED && (GetCurrentTime() - This->last_warped > 10)) {
 	dinput_window_check(This);
 	TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
 	SetCursorPos( This->mapped_center.x, This->mapped_center.y );
-	
+        This->last_warped = GetCurrentTime();
+
 #ifdef MOUSE_HACK
 	This->need_warp = WARP_DONE;
 #else
@@ -791,11 +795,12 @@ static HRESULT WINAPI SysMouseAImpl_GetD
     LeaveCriticalSection(&(This->crit));
     
     /* Check if we need to do a mouse warping */
-    if (This->need_warp == WARP_NEEDED) {
+    if (This->need_warp == WARP_NEEDED && (GetCurrentTime() - This->last_warped > 10)) {
 	dinput_window_check(This);
 	TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
 	SetCursorPos( This->mapped_center.x, This->mapped_center.y );
-	
+        This->last_warped = GetCurrentTime();
+
 #ifdef MOUSE_HACK
 	This->need_warp = WARP_DONE;
 #else