dinput: Pass event instance ID to queue_event instead of offset.

This commit is contained in:
Vitaliy Margolen 2009-11-29 21:07:25 -07:00 committed by Alexandre Julliard
parent 29561f492e
commit 2665272d6c
6 changed files with 9 additions and 11 deletions

View File

@ -533,10 +533,10 @@ int find_property(const DataFormat *df, LPCDIPROPHEADER ph)
* queue_event - add new event to the ring queue
*/
void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq)
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
{
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
int next_pos;
int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
/* Event is being set regardless of the queue state */
if (This->hEvent) SetEvent(This->hEvent);

View File

@ -78,7 +78,7 @@ extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
/* Routines to do DataFormat / WineFormat conversions */
extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
extern void release_DataFormat(DataFormat *df) ;
extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq);
extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq);
/* Helper functions to work with data format */
extern int id_to_object(LPCDIDATAFORMAT df, int id);
extern int id_to_offset(const DataFormat *df, int id);

View File

@ -614,8 +614,7 @@ static void joy_polldev(JoystickGenericImpl *This_in) {
}
}
if (inst_id >= 0)
queue_event((LPDIRECTINPUTDEVICE8A)This,
id_to_offset(&This->generic.base.data_format, inst_id),
queue_event((LPDIRECTINPUTDEVICE8A)This, inst_id,
value, jse.time, This->generic.base.dinput->evsequence++);
}
}

View File

@ -824,8 +824,7 @@ static void joy_polldev(JoystickGenericImpl *iface)
break;
}
if (inst_id >= 0)
queue_event((LPDIRECTINPUTDEVICE8A)This,
id_to_offset(&This->generic.base.data_format, inst_id),
queue_event((LPDIRECTINPUTDEVICE8A)This, inst_id,
value, ie.time.tv_usec, This->generic.base.dinput->evsequence++);
}
}

View File

@ -107,9 +107,9 @@ static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
This->DInputKeyState[dik_code] = new_diks;
TRACE(" setting %02X to %02X\n", dik_code, This->DInputKeyState[dik_code]);
dik_code = id_to_offset(&This->base.data_format, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON);
EnterCriticalSection(&This->base.crit);
queue_event((LPDIRECTINPUTDEVICE8A)This, dik_code, new_diks, hook->time, This->base.dinput->evsequence++);
queue_event((LPDIRECTINPUTDEVICE8A)This, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON,
new_diks, hook->time, This->base.dinput->evsequence++);
LeaveCriticalSection(&This->base.crit);
return ret;

View File

@ -324,7 +324,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
{
/* Already have X, need to queue it */
if (inst_id != -1)
queue_event((LPDIRECTINPUTDEVICE8A)This, id_to_offset(&This->base.data_format, inst_id),
queue_event((LPDIRECTINPUTDEVICE8A)This, inst_id,
wdata, GetCurrentTime(), This->base.dinput->evsequence);
inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
wdata = pt1.y;
@ -379,7 +379,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
if (inst_id != -1)
{
_dump_mouse_state(&This->m_state);
queue_event((LPDIRECTINPUTDEVICE8A)This, id_to_offset(&This->base.data_format, inst_id),
queue_event((LPDIRECTINPUTDEVICE8A)This, inst_id,
wdata, GetCurrentTime(), This->base.dinput->evsequence++);
}