Changeset 268390 in webkit


Ignore:
Timestamp:
Oct 13, 2020 2:20:44 AM (4 years ago)
Author:
Adrian Perez de Castro
Message:

[GTK] Make gamepads visible after their first input is received
https://bugs.webkit.org/show_bug.cgi?id=217494

Reviewed by Carlos Garcia Campos.

Turns out this was mostly working already, with a small caveat: Sometimes there would
be a timing issue if m_inputNotificationTimer would be fired before having a chance
of setting the m_initialGamepadsConnected flag, and in that case the early return
would prevent dispatchPlatformGamepadInputActivity() from ever being called. This
re-arms the timer to be fired again in the next event loop iteration if the flag was
unset, so it will be checked again after it has been toggled. This same approach is
used by HIDGamepadProvider in the Mac port, for example.

  • platform/gamepad/manette/ManetteGamepadProvider.cpp:

(WebCore::ManetteGamepadProvider::inputNotificationTimerFired): Re-arm timer if
m_initialGamepadsConnected was not yet set.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r268386 r268390  
     12020-10-13  Adrian Perez de Castro  <aperez@igalia.com>
     2
     3        [GTK] Make gamepads visible after their first input is received
     4        https://bugs.webkit.org/show_bug.cgi?id=217494
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Turns out this was mostly working already, with a small caveat: Sometimes there would
     9        be a timing issue if m_inputNotificationTimer would be fired before having a chance
     10        of setting the m_initialGamepadsConnected flag, and in that case the early return
     11        would prevent dispatchPlatformGamepadInputActivity() from ever being called. This
     12        re-arms the timer to be fired again in the next event loop iteration if the flag was
     13        unset, so it will be checked again after it has been toggled. This same approach is
     14        used by HIDGamepadProvider in the Mac port, for example.
     15
     16        * platform/gamepad/manette/ManetteGamepadProvider.cpp:
     17        (WebCore::ManetteGamepadProvider::inputNotificationTimerFired): Re-arm timer if
     18        m_initialGamepadsConnected was not yet set.
     19
    1202020-10-13  Kimmo Kinnunen  <kkinnunen@apple.com>
    221
  • trunk/Source/WebCore/platform/gamepad/manette/ManetteGamepadProvider.cpp

    r268312 r268390  
    174174void ManetteGamepadProvider::inputNotificationTimerFired()
    175175{
    176     if (!m_initialGamepadsConnected)
     176    if (!m_initialGamepadsConnected) {
     177        if (!m_inputNotificationTimer.isActive())
     178            m_inputNotificationTimer.startOneShot(0_s);
    177179        return;
     180    }
    178181
    179182    dispatchPlatformGamepadInputActivity();
Note: See TracChangeset for help on using the changeset viewer.