[dinput 3/5] Move the config for the buttons from the JoyDev into the JoystickImpl

Christoph Frick frick at sc-networks.de
Mon Jan 15 05:08:00 CST 2007


Move the config for the buttons from the JoyDev into the JoystickImpl
---

 dlls/dinput/joystick_linuxinput.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index efdb040..0908424 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -111,8 +111,6 @@ struct JoyDev {
 
 	/* data returned by the EVIOCGABS() ioctl */
 	int				axes[ABS_MAX][5];
-	/* LUT for KEY_ to offset in rgbButtons */
-	BYTE				buttons[KEY_MAX];
 };
 
 struct ObjProps
@@ -142,6 +140,9 @@ struct JoystickImpl
 
 	struct ObjProps                 props[ABS_MAX];
 
+	/* LUT for KEY_ to offset in rgbButtons */
+	BYTE				buttons[KEY_MAX];
+
 	/* Force feedback variables */
 	EffectListItem*			top_effect;
 	int				ff_state;
@@ -181,7 +182,7 @@ static void find_joydevs(void)
     struct JoyDev joydev = {0};
     int fd;
     int no_ff_check = 0;
-    int j, buttons;
+    int j;
 
     snprintf(buf,MAX_PATH,EVDEVPREFIX"%d",i);
     buf[MAX_PATH-1] = 0;
@@ -262,15 +263,6 @@ static void find_joydevs(void)
 	  }
 	}
 
-	buttons = 0;
-	for (j=0;j<KEY_MAX;j++) {
-	  if (test_bit(joydev.keybits,j)) {
-	    TRACE(" ... with button %d: %d\n", j, buttons);
-	    joydev.buttons[j] = 0x80 | buttons;
-	    buttons++;
-	  }
-	}
-
 	if (have_joydevs==0) {
 	  joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev));
 	} else {
@@ -417,6 +409,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
         if (!test_bit(newDevice->joydev->keybits, i)) continue;
 
         memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[btn + WINE_JOYSTICK_BUTTON_BASE], df->dwObjSize);
+	newDevice->buttons[i] = 0x80 | btn;
         df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(btn++) | DIDFT_PSHBUTTON;
     }
     df->dwNumObjs = idx;
@@ -723,7 +716,7 @@ static void joy_polldev(JoystickImpl *This)
 	switch (ie.type) {
 	case EV_KEY:	/* button */
         {
-            int btn = This->joydev->buttons[ie.code];
+            int btn = This->buttons[ie.code];
 
             TRACE("(%p) %d -> %d\n", This, ie.code, btn);
             if (btn & 0x80)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070115/067a66f5/attachment.pgp


More information about the wine-patches mailing list