• Arkadiusz Hiler's avatar
    dinput/tests: Make overlapped format tests more robust. · 5cb70e73
    Arkadiusz Hiler authored
    Both Acquire() and event processing with DirectInput seem to be
    asynchronous. In most cases we can just keep hammering GetDeviceData()
    until the event gets processed.
    
    Things get pretty racy around Acquire() though. If we fire event right
    after the device is acquired we can find ourselves in one of the three
    situations:
    
    1. Event happened after acquiring has completed - the wait will suffice.
    
    2. Event happened before acquiring did any real work - the device will
       pick up the state as if the event was processed, but there's nothing
       in GetDeviceData(). Because of that we cannot fail on wait.
    
    3. Event happened somewhere in the middle of acquiring - we ended up
       both missing the event for GetDeviceData() and we have outdated
       state. Sending event again will register as if the button was not
       already pressed.
    
    This change covers all three scenarios.
    Signed-off-by: 's avatarArkadiusz Hiler <ahiler@codeweavers.com>
    Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    5cb70e73
Name
Last commit
Last update
..
tests Loading commit data...
Makefile.in Loading commit data...
ansi.c Loading commit data...
config.c Loading commit data...
data_formats.c Loading commit data...
device.c Loading commit data...
device_private.h Loading commit data...
dinput.rc Loading commit data...
dinput.spec Loading commit data...
dinput_classes.idl Loading commit data...
dinput_main.c Loading commit data...
dinput_private.h Loading commit data...
effect_linuxinput.c Loading commit data...
joystick.c Loading commit data...
joystick_linux.c Loading commit data...
joystick_linuxinput.c Loading commit data...
joystick_osx.c Loading commit data...
joystick_private.h Loading commit data...
keyboard.c Loading commit data...
mouse.c Loading commit data...
resource.h Loading commit data...
version.rc Loading commit data...