Commit 91d9819c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Fire the notification only after all events have been queued.

parent 334d89a2
......@@ -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);
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)
{
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, &params );
enum_button_objects( impl, &filter, DIDFT_ALL, check_device_state_button, &params );
if (memcmp( &params.old_state, &impl->state, sizeof(impl->state) ) && impl->base.hEvent)
SetEvent( impl->base.hEvent );
}
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) );
......
......@@ -777,7 +777,10 @@ static void joy_polldev( IDirectInputDevice8W *iface )
}
}
if (inst_id >= 0)
{
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;
}
if (inst_id >= 0)
{
queue_event(iface, inst_id,
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;
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
if (device->generic.base.hEvent)
SetEvent( device->generic.base.hEvent );
}
button_idx ++;
}
......@@ -870,6 +872,8 @@ static void poll_osx_device_state( IDirectInputDevice8W *iface )
{
inst_id = DIDFT_MAKEINSTANCE(pov_idx) | DIDFT_POV;
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
if (device->generic.base.hEvent)
SetEvent( device->generic.base.hEvent );
}
pov_idx ++;
break;
......@@ -947,6 +951,8 @@ static void poll_osx_device_state( IDirectInputDevice8W *iface )
{
inst_id = DIDFT_MAKEINSTANCE(wine_obj) | DIDFT_ABSAXIS;
queue_event(iface,inst_id,newVal,GetCurrentTime(),device->generic.base.dinput->evsequence++);
if (device->generic.base.hEvent)
SetEvent( device->generic.base.hEvent );
}
break;
......
......@@ -127,6 +127,7 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa
EnterCriticalSection(&This->base.crit);
queue_event(iface, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON,
new_diks, GetCurrentTime(), This->base.dinput->evsequence++);
if (This->base.hEvent) SetEvent( This->base.hEvent );
LeaveCriticalSection(&This->base.crit);
return ret;
......
......@@ -234,6 +234,7 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
POINT rel, pt;
DWORD seq;
int i, wdata = 0;
BOOL notify = FALSE;
static const USHORT mouse_button_flags[] =
{
......@@ -277,12 +278,18 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
}
if (rel.x)
{
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS,
pt.x, GetCurrentTime(), seq );
notify = TRUE;
}
if (rel.y)
{
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS,
pt.y, GetCurrentTime(), seq );
notify = TRUE;
}
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);
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
wdata, GetCurrentTime(), seq );
notify = TRUE;
}
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;
queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE +(i / 2) ) | DIDFT_PSHBUTTON,
This->m_state.rgbButtons[i / 2], GetCurrentTime(), seq );
notify = TRUE;
}
}
if (notify && This->base.hEvent) SetEvent( This->base.hEvent );
LeaveCriticalSection( &This->base.crit );
}
......@@ -317,6 +327,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam
MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
SysMouseImpl *This = impl_from_IDirectInputDevice8W( iface );
int wdata = 0, inst_id = -1, ret = 0;
BOOL notify = FALSE;
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 */
if (inst_id != -1)
{
queue_event(iface, inst_id,
wdata, GetCurrentTime(), This->base.dinput->evsequence);
notify = TRUE;
}
inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
wdata = pt1.y;
}
......@@ -408,8 +422,10 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam
_dump_mouse_state(&This->m_state);
queue_event(iface, inst_id,
wdata, GetCurrentTime(), This->base.dinput->evsequence++);
notify = TRUE;
}
if (notify && This->base.hEvent) SetEvent( This->base.hEvent );
LeaveCriticalSection(&This->base.crit);
return ret;
}
......
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