Bug 1375816 - Part 2: DisplayId support in GamepadManager; r=Lenzak

MozReview-Commit-ID: 1zrePACFQWf

--HG--
extra : rebase_source : d96f344c5d0c422c496880f47076d731d60f2330
This commit is contained in:
Daosheng Mu 2017-07-14 16:55:52 +08:00
Родитель 4f33b3d9da
Коммит 2c94bb9dc0
5 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -226,6 +226,7 @@ GamepadManager::AddGamepad(uint32_t aIndex,
GamepadMappingType aMapping,
GamepadHand aHand,
GamepadServiceType aServiceType,
uint32_t aDisplayID,
uint32_t aNumButtons,
uint32_t aNumAxes,
uint32_t aNumHaptics)
@ -240,6 +241,7 @@ GamepadManager::AddGamepad(uint32_t aIndex,
newIndex,
aMapping,
aHand,
aDisplayID,
aNumButtons,
aNumAxes,
aNumHaptics);
@ -509,6 +511,7 @@ GamepadManager::Update(const GamepadChangeEvent& aEvent)
static_cast<GamepadMappingType>(a.mapping()),
static_cast<GamepadHand>(a.hand()),
a.service_type(),
a.display_id(),
a.num_buttons(), a.num_axes(),
a.num_haptics());
return;

Просмотреть файл

@ -51,7 +51,7 @@ class GamepadManager final : public nsIObserver,
// Add a gamepad to the list of known gamepads.
void AddGamepad(uint32_t aIndex, const nsAString& aID, GamepadMappingType aMapping,
GamepadHand aHand, GamepadServiceType aServiceType,
GamepadHand aHand, GamepadServiceType aServiceType, uint32_t aDisplayID,
uint32_t aNumButtons, uint32_t aNumAxes, uint32_t aNumHaptics);
// Remove the gamepad at |aIndex| from the list of known gamepads.

Просмотреть файл

@ -96,9 +96,10 @@ GamepadPlatformService::AddGamepad(const char* aID,
MOZ_ASSERT(!NS_IsMainThread());
uint32_t index = ++mGamepadIndex;
// Only VR controllers has displayID, we give 0 to the general gamepads.
GamepadAdded a(NS_ConvertUTF8toUTF16(nsDependentCString(aID)), index,
aMapping, aHand, GamepadServiceType::Standard,
aNumButtons, aNumAxes, aHaptics);
0, aNumButtons, aNumAxes, aHaptics);
NotifyGamepadChange<GamepadAdded>(a);
return index;

Просмотреть файл

@ -123,9 +123,10 @@ GamepadServiceTest::AddGamepad(const nsAString& aID,
return nullptr;
}
// Only VR controllers has displayID, we give 0 to the general gamepads.
GamepadAdded a(nsString(aID), 0,
aMapping, aHand,
GamepadServiceType::Standard,
GamepadServiceType::Standard, 0,
aNumButtons, aNumAxes, aNumHaptics);
GamepadChangeEvent e(a);
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);

Просмотреть файл

@ -17,6 +17,7 @@ struct GamepadAdded {
GamepadMappingType mapping;
GamepadHand hand;
GamepadServiceType service_type;
uint32_t display_id;
uint32_t num_buttons;
uint32_t num_axes;
uint32_t num_haptics;