Bug 1359670 - Notify GamepadManager when controllers are removed in VRPuppet manager; r=kip

MozReview-Commit-ID: KSlpJy8i7Xo

--HG--
extra : rebase_source : 416e8fa155c15829f0c488a2a1bf5f4924a5f375
This commit is contained in:
Daosheng Mu 2017-04-26 11:23:23 +08:00
Родитель 3a6ad95915
Коммит 22637d7222
1 изменённых файлов: 5 добавлений и 7 удалений

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

@ -478,13 +478,7 @@ VRSystemManagerPuppet::ScanForControllers()
const uint32_t newControllerCount = 2;
if (newControllerCount != mControllerCount) {
// controller count is changed, removing the existing gamepads first.
for (uint32_t i = 0; i < mPuppetController.Length(); ++i) {
RemoveGamepad(i);
}
mControllerCount = 0;
mPuppetController.Clear();
RemoveControllers();
// Re-adding controllers to VRControllerManager.
for (uint32_t i = 0; i < newControllerCount; ++i) {
@ -503,6 +497,10 @@ VRSystemManagerPuppet::ScanForControllers()
void
VRSystemManagerPuppet::RemoveControllers()
{
// controller count is changed, removing the existing gamepads first.
for (uint32_t i = 0; i < mPuppetController.Length(); ++i) {
RemoveGamepad(i);
}
mPuppetController.Clear();
mControllerCount = 0;
}