dinput: Fire the notification only after all events have been queued.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
334d89a253
commit
91d9819c95
|
@ -986,9 +986,6 @@ void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD ti
|
||||||
int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
|
int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
|
||||||
ULONGLONG time_ms = GetTickCount64();
|
ULONGLONG time_ms = GetTickCount64();
|
||||||
|
|
||||||
/* Event is being set regardless of the queue state */
|
|
||||||
if (This->hEvent) SetEvent(This->hEvent);
|
|
||||||
|
|
||||||
if (time_ms - notify_ms > 1000)
|
if (time_ms - notify_ms > 1000)
|
||||||
{
|
{
|
||||||
PostMessageW(GetDesktopWindow(), WM_WINE_NOTIFY_ACTIVITY, 0, 0);
|
PostMessageW(GetDesktopWindow(), WM_WINE_NOTIFY_ACTIVITY, 0, 0);
|
||||||
|
|
|
@ -908,6 +908,8 @@ static HRESULT hid_joystick_read_state( IDirectInputDevice8W *iface )
|
||||||
|
|
||||||
enum_value_objects( impl, &filter, DIDFT_ALL, read_device_state_value, ¶ms );
|
enum_value_objects( impl, &filter, DIDFT_ALL, read_device_state_value, ¶ms );
|
||||||
enum_button_objects( impl, &filter, DIDFT_ALL, check_device_state_button, ¶ms );
|
enum_button_objects( impl, &filter, DIDFT_ALL, check_device_state_button, ¶ms );
|
||||||
|
if (memcmp( ¶ms.old_state, &impl->state, sizeof(impl->state) ) && impl->base.hEvent)
|
||||||
|
SetEvent( impl->base.hEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) );
|
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) );
|
||||||
|
|
|
@ -777,7 +777,10 @@ static void joy_polldev( IDirectInputDevice8W *iface )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inst_id >= 0)
|
if (inst_id >= 0)
|
||||||
|
{
|
||||||
queue_event(iface, inst_id, value, GetCurrentTime(), This->generic.base.dinput->evsequence++);
|
queue_event(iface, inst_id, value, GetCurrentTime(), This->generic.base.dinput->evsequence++);
|
||||||
|
if (This->generic.base.hEvent) SetEvent( This->generic.base.hEvent );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -806,8 +806,11 @@ static void joy_polldev( IDirectInputDevice8W *iface )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (inst_id >= 0)
|
if (inst_id >= 0)
|
||||||
|
{
|
||||||
queue_event(iface, inst_id,
|
queue_event(iface, inst_id,
|
||||||
value, GetCurrentTime(), This->generic.base.dinput->evsequence++);
|
value, GetCurrentTime(), This->generic.base.dinput->evsequence++);
|
||||||
|
if (This->generic.base.hEvent) SetEvent( This->generic.base.hEvent );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -840,6 +840,8 @@ static void poll_osx_device_state( IDirectInputDevice8W *iface )
|
||||||
{
|
{
|
||||||
inst_id = DIDFT_MAKEINSTANCE(button_idx) | DIDFT_PSHBUTTON;
|
inst_id = DIDFT_MAKEINSTANCE(button_idx) | DIDFT_PSHBUTTON;
|
||||||
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
|
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
|
||||||
|
if (device->generic.base.hEvent)
|
||||||
|
SetEvent( device->generic.base.hEvent );
|
||||||
}
|
}
|
||||||
button_idx ++;
|
button_idx ++;
|
||||||
}
|
}
|
||||||
|
@ -870,6 +872,8 @@ static void poll_osx_device_state( IDirectInputDevice8W *iface )
|
||||||
{
|
{
|
||||||
inst_id = DIDFT_MAKEINSTANCE(pov_idx) | DIDFT_POV;
|
inst_id = DIDFT_MAKEINSTANCE(pov_idx) | DIDFT_POV;
|
||||||
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
|
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
|
||||||
|
if (device->generic.base.hEvent)
|
||||||
|
SetEvent( device->generic.base.hEvent );
|
||||||
}
|
}
|
||||||
pov_idx ++;
|
pov_idx ++;
|
||||||
break;
|
break;
|
||||||
|
@ -947,6 +951,8 @@ static void poll_osx_device_state( IDirectInputDevice8W *iface )
|
||||||
{
|
{
|
||||||
inst_id = DIDFT_MAKEINSTANCE(wine_obj) | DIDFT_ABSAXIS;
|
inst_id = DIDFT_MAKEINSTANCE(wine_obj) | DIDFT_ABSAXIS;
|
||||||
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
|
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
|
||||||
|
if (device->generic.base.hEvent)
|
||||||
|
SetEvent( device->generic.base.hEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -127,6 +127,7 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa
|
||||||
EnterCriticalSection(&This->base.crit);
|
EnterCriticalSection(&This->base.crit);
|
||||||
queue_event(iface, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON,
|
queue_event(iface, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON,
|
||||||
new_diks, GetCurrentTime(), This->base.dinput->evsequence++);
|
new_diks, GetCurrentTime(), This->base.dinput->evsequence++);
|
||||||
|
if (This->base.hEvent) SetEvent( This->base.hEvent );
|
||||||
LeaveCriticalSection(&This->base.crit);
|
LeaveCriticalSection(&This->base.crit);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -234,6 +234,7 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
|
||||||
POINT rel, pt;
|
POINT rel, pt;
|
||||||
DWORD seq;
|
DWORD seq;
|
||||||
int i, wdata = 0;
|
int i, wdata = 0;
|
||||||
|
BOOL notify = FALSE;
|
||||||
|
|
||||||
static const USHORT mouse_button_flags[] =
|
static const USHORT mouse_button_flags[] =
|
||||||
{
|
{
|
||||||
|
@ -277,12 +278,18 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rel.x)
|
if (rel.x)
|
||||||
|
{
|
||||||
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||||
pt.x, GetCurrentTime(), seq );
|
pt.x, GetCurrentTime(), seq );
|
||||||
|
notify = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (rel.y)
|
if (rel.y)
|
||||||
|
{
|
||||||
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||||
pt.y, GetCurrentTime(), seq );
|
pt.y, GetCurrentTime(), seq );
|
||||||
|
notify = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (rel.x || rel.y)
|
if (rel.x || rel.y)
|
||||||
{
|
{
|
||||||
|
@ -296,6 +303,7 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
|
||||||
This->m_state.lZ += (wdata = (SHORT)ri->data.mouse.usButtonData);
|
This->m_state.lZ += (wdata = (SHORT)ri->data.mouse.usButtonData);
|
||||||
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||||
wdata, GetCurrentTime(), seq );
|
wdata, GetCurrentTime(), seq );
|
||||||
|
notify = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(mouse_button_flags); ++i)
|
for (i = 0; i < ARRAY_SIZE(mouse_button_flags); ++i)
|
||||||
|
@ -305,9 +313,11 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
|
||||||
This->m_state.rgbButtons[i / 2] = 0x80 - (i % 2) * 0x80;
|
This->m_state.rgbButtons[i / 2] = 0x80 - (i % 2) * 0x80;
|
||||||
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE +(i / 2) ) | DIDFT_PSHBUTTON,
|
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE +(i / 2) ) | DIDFT_PSHBUTTON,
|
||||||
This->m_state.rgbButtons[i / 2], GetCurrentTime(), seq );
|
This->m_state.rgbButtons[i / 2], GetCurrentTime(), seq );
|
||||||
|
notify = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (notify && This->base.hEvent) SetEvent( This->base.hEvent );
|
||||||
LeaveCriticalSection( &This->base.crit );
|
LeaveCriticalSection( &This->base.crit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,6 +327,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam
|
||||||
MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
|
MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
|
||||||
SysMouseImpl *This = impl_from_IDirectInputDevice8W( iface );
|
SysMouseImpl *This = impl_from_IDirectInputDevice8W( iface );
|
||||||
int wdata = 0, inst_id = -1, ret = 0;
|
int wdata = 0, inst_id = -1, ret = 0;
|
||||||
|
BOOL notify = FALSE;
|
||||||
|
|
||||||
TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
|
TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
|
||||||
|
|
||||||
|
@ -347,8 +358,11 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM 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(iface, inst_id,
|
queue_event(iface, inst_id,
|
||||||
wdata, GetCurrentTime(), This->base.dinput->evsequence);
|
wdata, GetCurrentTime(), This->base.dinput->evsequence);
|
||||||
|
notify = TRUE;
|
||||||
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -408,8 +422,10 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam
|
||||||
_dump_mouse_state(&This->m_state);
|
_dump_mouse_state(&This->m_state);
|
||||||
queue_event(iface, inst_id,
|
queue_event(iface, inst_id,
|
||||||
wdata, GetCurrentTime(), This->base.dinput->evsequence++);
|
wdata, GetCurrentTime(), This->base.dinput->evsequence++);
|
||||||
|
notify = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (notify && This->base.hEvent) SetEvent( This->base.hEvent );
|
||||||
LeaveCriticalSection(&This->base.crit);
|
LeaveCriticalSection(&This->base.crit);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue