dinput cleanup

Andreas Mohr andi at rhlx01.fht-esslingen.de
Sun Mar 3 18:07:21 CST 2002


Hi all,

originally I tried to debug why some game's cursor was stuck in the middle,
but I couldn't find it out properly (due to incomprehensible warping magic).
This is said to be broken since moving the code from direct X11 addressing
to USER driver addressing.

- apply some small cleanups to dinput mouse code

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/dinput/mouse/main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/mouse/main.c,v
retrieving revision 1.10
diff -u -r1.10 main.c
--- dlls/dinput/mouse/main.c	18 Oct 2001 21:30:46 -0000	1.10
+++ dlls/dinput/mouse/main.c	3 Mar 2002 22:08:53 -0000
@@ -109,6 +109,8 @@
         DWORD				win_centerX, win_centerY;
         LPDIDEVICEOBJECTDATA 		data_queue;
         int				queue_head, queue_tail, queue_len;
+	/* 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;
         int				acquired;
         HANDLE				hEvent;
@@ -132,7 +134,7 @@
 static BOOL mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPCDIDEVICEINSTANCEA lpddi)
 {
   if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_MOUSE)) {
-    TRACE("Enumerating the Mouse device\n");
+    TRACE("Enumerating the mouse device\n");
 
     /* Return mouse */
     lpddi->guidInstance = GUID_SysMouse;/* DInput's GUID */
@@ -350,7 +352,7 @@
 	      GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->prevY, hook->time, (This->dinput->evsequence)++);
 	  } else {
 	    /* This is the first time the event handler has been called after a
-	       GetData of GetState. */
+	       GetDeviceData or GetDeviceState. */
 	    if (hook->pt.x != This->mapped_center.x) {
 	      GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->mapped_center.x, hook->time, (This->dinput->evsequence)++);
 	      This->need_warp = WARP_NEEDED;
@@ -375,8 +377,8 @@
 	}
     }
 
-    TRACE(" msg %x pt %ld %ld (W=%d)",
-          wparam, hook->pt.x, hook->pt.y, This->absolute && This->need_warp );
+    TRACE(" msg %x pt %ld %ld (W=%d)\n",
+          wparam, hook->pt.x, hook->pt.y, (!This->absolute) && This->need_warp );
 
     switch(wparam)
     {
@@ -657,7 +659,7 @@
     case (DWORD) DIPROP_AXISMODE: {
       LPCDIPROPDWORD    pd = (LPCDIPROPDWORD)ph;
       This->absolute = !(pd->dwData);
-      TRACE("absolute mode: %d\n", This->absolute);
+      TRACE("Using %s coordinates mode now\n", This->absolute ? "absolute" : "relative");
       break;
     }
     default:
@@ -701,7 +703,7 @@
 	  ((pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS)) ||
 	   (pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS)))) {
 	/* Querying the range of either the X or the Y axis.  As I do
-	   not know the range, do as if the range where
+	   not know the range, do as if the range were
 	   unrestricted...*/
 	pr->lMin = DIPROPRANGE_NOMIN;
 	pr->lMax = DIPROPRANGE_NOMAX;


More information about the wine-patches mailing list