Skip to content

Commit

Permalink
bug 852935 - Add Android gamepad backend. r=snorp, rs=smaug
Browse files Browse the repository at this point in the history
  • Loading branch information
luser committed Apr 22, 2014
1 parent 855391a commit 5b6eee4
Show file tree
Hide file tree
Showing 17 changed files with 706 additions and 6 deletions.
8 changes: 8 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -5949,6 +5949,11 @@ case "$OS_TARGET" in
Darwin|WINNT|Linux)
MOZ_GAMEPAD=1
;;
Android)
if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
MOZ_GAMEPAD=1
fi
;;
*)
;;
esac
Expand All @@ -5973,6 +5978,9 @@ if test "$MOZ_GAMEPAD"; then
fi
MOZ_GAMEPAD_BACKEND=linux
;;
Android)
MOZ_GAMEPAD_BACKEND=android
;;
*)
;;
esac
Expand Down
10 changes: 5 additions & 5 deletions dom/tests/mochitest/general/test_interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,15 @@
// IMPORTANT: Do not change this list without review from a DOM peer!
"GainNode",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "Gamepad", desktop: true},
{name: "Gamepad", b2g: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "GamepadAxisMoveEvent", desktop: true},
{name: "GamepadAxisMoveEvent", b2g: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "GamepadButtonEvent", desktop: true},
{name: "GamepadButtonEvent", b2g: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "GamepadButton", desktop: true},
{name: "GamepadButton", b2g: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "GamepadEvent", desktop: true},
{name: "GamepadEvent", b2g: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
"HashChangeEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
Expand Down
27 changes: 27 additions & 0 deletions hal/android/AndroidGamepad.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "Hal.h"
#include "AndroidBridge.h"

using namespace mozilla::hal;

namespace mozilla {
namespace hal_impl {

void
StartMonitoringGamepadStatus()
{
mozilla::widget::android::GeckoAppShell::StartMonitoringGamepad();
}

void
StopMonitoringGamepadStatus()
{
mozilla::widget::android::GeckoAppShell::StopMonitoringGamepad();
}

} // hal_impl
} // mozilla
4 changes: 4 additions & 0 deletions hal/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
UNIFIED_SOURCES += [
'linux/LinuxGamepad.cpp'
]
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
UNIFIED_SOURCES += [
'android/AndroidGamepad.cpp'
]

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
UNIFIED_SOURCES += [
Expand Down
Loading

0 comments on commit 5b6eee4

Please sign in to comment.