Skip to content
  • zandobersek@gmail.com's avatar
    [Gtk] Add support for the Gamepad API · c8bac580
    zandobersek@gmail.com authored
    https://bugs.webkit.org/show_bug.cgi?id=87503
    
    Reviewed by Carlos Garcia Campos.
    
    .: 
    
    Only enable the Gamepad feature on Linux as support
    for other operating systems is not present.
    
    Check for the GIO Unix and GUdev dependencies when the
    Gamepad feature is enabled.
    
    * configure.ac:
    
    Source/WebCore: 
    
    Add support for the Gamepad feature on the GTK port.
    
    The support is available only on Linux, with each gamepad device being presented
    through a GamepadDeviceLinux object. The implementation of this class relies on
    the Linux kernel joystick API.
    
    Gamepad devices are recognized through the GamepadsGtk class, of which implementation
    is based on GUdev. This way devices are properly registered on connection as objects of
    the GamepadDeviceGtk class which inherits GamepadDeviceLinux. GamepadDeviceGtk reads the
    joystick data through GIO pollable streams and updates the device state accordingly. The
    GamepadsGtk object is then polled for gamepads data through the sampleGamepads method.
    
    No new tests - tests already exist but require additional testing infrastructure.
    
    * GNUmakefile.am:
    * GNUmakefile.list.am:
    * bindings/gobject/GNUmakefile.am:
    * bindings/js/JSDOMBinding.h: Add the jsArray method that operates on a Vector of floats.
    (WebCore):
    (WebCore::jsArray):
    * platform/gtk/GamepadsGtk.cpp: Added.
    (WebCore):
    (GamepadDeviceGtk):
    (WebCore::GamepadDeviceGtk::create):
    (WebCore::GamepadDeviceGtk::GamepadDeviceGtk):
    (WebCore::GamepadDeviceGtk::~GamepadDeviceGtk):
    (WebCore::GamepadDeviceGtk::readCallback):
    (GamepadsGtk):
    (WebCore::GamepadsGtk::GamepadsGtk):
    (WebCore::GamepadsGtk::~GamepadsGtk):
    (WebCore::GamepadsGtk::registerDevice):
    (WebCore::GamepadsGtk::unregisterDevice):
    (WebCore::GamepadsGtk::updateGamepadList):
    (WebCore::GamepadsGtk::onUEventCallback):
    (WebCore::GamepadsGtk::isGamepadDevice):
    (WebCore::sampleGamepads):
    * platform/linux/GamepadDeviceLinux.cpp: Added.
    (WebCore):
    (WebCore::GamepadDeviceLinux::GamepadDeviceLinux):
    (WebCore::GamepadDeviceLinux::~GamepadDeviceLinux):
    (WebCore::GamepadDeviceLinux::updateForEvent):
    (WebCore::GamepadDeviceLinux::normalizeAxisValue):
    (WebCore::GamepadDeviceLinux::normalizeButtonValue):
    * platform/linux/GamepadDeviceLinux.h: Added.
    (WebCore):
    (GamepadDeviceLinux):
    (WebCore::GamepadDeviceLinux::connected):
    (WebCore::GamepadDeviceLinux::id):
    (WebCore::GamepadDeviceLinux::timestamp):
    (WebCore::GamepadDeviceLinux::axesCount):
    (WebCore::GamepadDeviceLinux::axesData):
    (WebCore::GamepadDeviceLinux::buttonsCount):
    (WebCore::GamepadDeviceLinux::buttonsData):
    
    Source/WebKit/gtk: 
    
    Add the Gamepad feature dependencies libraries to the LIBADD
    list for the libwebkitgtk library.
    
    * GNUmakefile.am:
    
    Source/WebKit2: 
    
    Add the Gamepad feature dependencies libraries to the LIBADD
    list for the libwebkitgtk2 library.
    
    * GNUmakefile.am:
    
    Tools: 
    
    Enable the gamepad support for the GTK port.
    
    * Scripts/webkitperl/FeatureList.pm:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    c8bac580