зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540206 - Fixing VRController gamepad id null terminator characters. r=kip
Differential Revision: https://phabricator.services.mozilla.com/D25826 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ce2f2d7371
Коммит
f128a608ee
|
@ -326,7 +326,7 @@ VRDisplay::VRDisplay(nsPIDOMWindowInner* aWindow, gfx::VRDisplayClient* aClient)
|
|||
mShutdown(false) {
|
||||
const gfx::VRDisplayInfo& info = aClient->GetDisplayInfo();
|
||||
mDisplayId = info.GetDisplayID();
|
||||
mDisplayName = NS_ConvertASCIItoUTF16(info.GetDisplayName());
|
||||
mDisplayName = NS_ConvertUTF8toUTF16(info.GetDisplayName());
|
||||
mCapabilities = new VRDisplayCapabilities(aWindow, info.GetCapabilities());
|
||||
if (info.GetCapabilities() &
|
||||
gfx::VRDisplayCapabilityFlags::Cap_StageParameters) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
async_test(function(t) {
|
||||
window.addEventListener("gamepadbuttondown", function(e) {
|
||||
assert_equals(e.gamepad.displayId, vrDisplay.displayId, "gamepad.displayId should be equal to vrDisplay.");
|
||||
assert_equals(e.gamepad.id, "Puppet Gamepad", "gamepad.id must be equal to 'Puppet Gamepad'.");
|
||||
++controllerCount;
|
||||
if (controllerCount == 2) {
|
||||
t.done();
|
||||
|
@ -42,6 +43,7 @@
|
|||
return navigator.getVRDisplays().then((displays) => {
|
||||
vrDisplay = displays[0];
|
||||
assert_equals(displays.length, 1, "displays.length must be one after attach.");
|
||||
assert_equals(vrDisplay.displayName, "Puppet HMD", "display.displayName must be equal to 'Puppet HMD'.");
|
||||
addController();
|
||||
addController();
|
||||
});
|
||||
|
|
|
@ -159,7 +159,7 @@ void VRDisplayClient::FireGamepadEvents() {
|
|||
if ((lastState.controllerName[0] == '\0' || !existing) &&
|
||||
(state.numButtons > 0 || state.numAxes > 0)) {
|
||||
dom::GamepadAdded info(
|
||||
NS_ConvertUTF8toUTF16(state.controllerName, kVRControllerNameMaxLen),
|
||||
NS_ConvertUTF8toUTF16(state.controllerName),
|
||||
dom::GamepadMappingType::_empty, state.hand, mDisplayInfo.mDisplayID,
|
||||
state.numButtons, state.numAxes, state.numHaptics);
|
||||
dom::GamepadChangeEventBody body(info);
|
||||
|
|
Загрузка…
Ссылка в новой задаче