[Gtk] Add support for the Gamepad API
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2012 09:19:15 +0000 (09:19 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2012 09:19:15 +0000 (09:19 +0000)
commit1100197f0a9b2fd7fdacf5d17f7449a3b94124bb
treeeef7c74ae3c843b003aa14b7a894cdd8480a46d0
parentb800aecc77ebfab13d2e5b579c3cb80719d3a8ed
[Gtk] Add support for the Gamepad API
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: https://svn.webkit.org/repository/webkit/trunk@121332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/bindings/gobject/GNUmakefile.am
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/platform/gtk/GamepadsGtk.cpp [new file with mode: 0644]
Source/WebCore/platform/linux/GamepadDeviceLinux.cpp [new file with mode: 0644]
Source/WebCore/platform/linux/GamepadDeviceLinux.h [new file with mode: 0644]
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
Tools/ChangeLog
Tools/Scripts/webkitperl/FeatureList.pm
configure.ac