зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382438 - Part 2: Replace vr controller displayId test with gamepadbuttondown event; r=kip
MozReview-Commit-ID: DSTg2IS407e --HG-- extra : rebase_source : dba54bda77ff75f1d9e929ae7339b36d38e4e001
This commit is contained in:
Родитель
e709ee722a
Коммит
9297f5b2a3
|
@ -6,8 +6,8 @@ support-files =
|
|||
WebVRHelpers.js
|
||||
|
||||
[test_vrController_displayId.html]
|
||||
# Enable Linux after Bug 1310655 # TIMED_OUT for nonE10s and Android.
|
||||
skip-if = (os != "win" && release_or_beta) || (!e10s) || (os == "android")
|
||||
# Enable Linux after Bug 1310655 # TIMED_OUT for Android.
|
||||
skip-if = (os != "win" && release_or_beta) || (os == "android")
|
||||
[test_vrDisplay_canvas2d.html]
|
||||
skip-if = (os != "win" && release_or_beta) # Enable Linux after Bug 1310655
|
||||
[test_vrDisplay_exitPresent.html]
|
||||
|
|
|
@ -25,11 +25,10 @@
|
|||
|
||||
function listenControllerEvents() {
|
||||
async_test(function(t) {
|
||||
window.addEventListener("gamepadconnected", function() {
|
||||
var gamepads = navigator.getGamepads();
|
||||
assert_equals(gamepads[controllerCount].displayId, vrDisplay.displayId, "gamepad.displayId should be equal to vrDisplay.");
|
||||
window.addEventListener("gamepadbuttondown", function(e) {
|
||||
assert_equals(e.gamepad.displayId, vrDisplay.displayId, "gamepad.displayId should be equal to vrDisplay.");
|
||||
++controllerCount;
|
||||
if (controllerCount == 1) {
|
||||
if (controllerCount == 2) {
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
|
@ -44,6 +43,7 @@
|
|||
assert_equals(displays.length, 1, "displays.length must be one after attach.");
|
||||
assert_equals(displays[0].displayId, 1, "displayId must be one.");
|
||||
addController();
|
||||
addController();
|
||||
});
|
||||
}, "Finish to add VRDisplay.");
|
||||
}
|
||||
|
|
|
@ -498,6 +498,7 @@ VRDisplayPuppet::NotifyVSync()
|
|||
VRControllerPuppet::VRControllerPuppet(dom::GamepadHand aHand, uint32_t aDisplayID)
|
||||
: VRControllerHost(VRDeviceType::Puppet, aHand, aDisplayID)
|
||||
, mButtonPressState(0)
|
||||
, mButtonTouchState(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR_INHERITED(VRControllerPuppet, VRControllerHost);
|
||||
mControllerInfo.mControllerName.AssignLiteral("Puppet Gamepad");
|
||||
|
@ -651,10 +652,11 @@ VRSystemManagerPuppet::HandleInput()
|
|||
for (uint32_t i = 0; i < mPuppetController.Length(); ++i) {
|
||||
controller = mPuppetController[i];
|
||||
for (uint32_t j = 0; j < kNumPuppetButtonMask; ++j) {
|
||||
HandleButtonPress(i, j, kPuppetButtonMask[i], controller->GetButtonPressState(),
|
||||
HandleButtonPress(i, j, kPuppetButtonMask[j], controller->GetButtonPressState(),
|
||||
controller->GetButtonTouchState());
|
||||
}
|
||||
controller->SetButtonPressed(controller->GetButtonPressState());
|
||||
controller->SetButtonTouched(controller->GetButtonTouchState());
|
||||
|
||||
for (uint32_t j = 0; j < kNumPuppetAxis; ++j) {
|
||||
HandleAxisMove(i, j, controller->GetAxisMoveState(j));
|
||||
|
|
Загрузка…
Ссылка в новой задаче