Commit 2665272d authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

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

parent 29561f49
...@@ -533,10 +533,10 @@ int find_property(const DataFormat *df, LPCDIPROPHEADER ph) ...@@ -533,10 +533,10 @@ int find_property(const DataFormat *df, LPCDIPROPHEADER ph)
* queue_event - add new event to the ring queue * 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; 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 */ /* Event is being set regardless of the queue state */
if (This->hEvent) SetEvent(This->hEvent); if (This->hEvent) SetEvent(This->hEvent);
......
...@@ -78,7 +78,7 @@ extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD); ...@@ -78,7 +78,7 @@ extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
/* Routines to do DataFormat / WineFormat conversions */ /* Routines to do DataFormat / WineFormat conversions */
extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ; extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
extern void release_DataFormat(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 */ /* Helper functions to work with data format */
extern int id_to_object(LPCDIDATAFORMAT df, int id); extern int id_to_object(LPCDIDATAFORMAT df, int id);
extern int id_to_offset(const DataFormat *df, int id); extern int id_to_offset(const DataFormat *df, int id);
......
...@@ -614,8 +614,7 @@ static void joy_polldev(JoystickGenericImpl *This_in) { ...@@ -614,8 +614,7 @@ static void joy_polldev(JoystickGenericImpl *This_in) {
} }
} }
if (inst_id >= 0) if (inst_id >= 0)
queue_event((LPDIRECTINPUTDEVICE8A)This, queue_event((LPDIRECTINPUTDEVICE8A)This, inst_id,
id_to_offset(&This->generic.base.data_format, inst_id),
value, jse.time, This->generic.base.dinput->evsequence++); value, jse.time, This->generic.base.dinput->evsequence++);
} }
} }
......
...@@ -824,8 +824,7 @@ static void joy_polldev(JoystickGenericImpl *iface) ...@@ -824,8 +824,7 @@ static void joy_polldev(JoystickGenericImpl *iface)
break; break;
} }
if (inst_id >= 0) if (inst_id >= 0)
queue_event((LPDIRECTINPUTDEVICE8A)This, queue_event((LPDIRECTINPUTDEVICE8A)This, inst_id,
id_to_offset(&This->generic.base.data_format, inst_id),
value, ie.time.tv_usec, This->generic.base.dinput->evsequence++); value, ie.time.tv_usec, This->generic.base.dinput->evsequence++);
} }
} }
......
...@@ -107,9 +107,9 @@ static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM ...@@ -107,9 +107,9 @@ static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
This->DInputKeyState[dik_code] = new_diks; This->DInputKeyState[dik_code] = new_diks;
TRACE(" setting %02X to %02X\n", dik_code, This->DInputKeyState[dik_code]); 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); 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); LeaveCriticalSection(&This->base.crit);
return ret; return ret;
......
...@@ -324,7 +324,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM ...@@ -324,7 +324,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
{ {
/* Already have X, need to queue it */ /* Already have X, need to queue it */
if (inst_id != -1) 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); wdata, GetCurrentTime(), This->base.dinput->evsequence);
inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS; inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
wdata = pt1.y; wdata = pt1.y;
...@@ -379,7 +379,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM ...@@ -379,7 +379,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
if (inst_id != -1) if (inst_id != -1)
{ {
_dump_mouse_state(&This->m_state); _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++); wdata, GetCurrentTime(), This->base.dinput->evsequence++);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment