Christoph Frick : dinput: Move the config for the buttons from the JoyDev into the JoystickImpl.
Module: wine Branch: master Commit: 0855a6be4c96b0f91c3687a82cb1bd30688520c4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0855a6be4c96b0f91c3687a82c... Author: Christoph Frick <frick(a)sc-networks.de> Date: Mon Jan 15 12:08:00 2007 +0100 dinput: 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(REFGUI 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 *Th 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)
participants (1)
-
Alexandre Julliard