Bug 1315896 - Part 3: Remove MOZ_GAMEPAD in VR module; r=kip

MozReview-Commit-ID: I9vJvxgFgIh

--HG--
extra : rebase_source : 270e971ace44b00d9877a67f68f349bbd9b550c1
This commit is contained in:
Daosheng Mu 2016-12-08 13:01:11 -10:00
Родитель 94effe3091
Коммит 370aa4a0c8
4 изменённых файлов: 10 добавлений и 25 удалений

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

@ -6,10 +6,8 @@
#include <math.h>
#include "gfxVR.h"
#ifdef MOZ_GAMEPAD
#include "mozilla/dom/GamepadEventTypes.h"
#include "mozilla/dom/GamepadBinding.h"
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846
@ -68,8 +66,8 @@ VRControllerManager::AllocateControllerID()
}
void
VRControllerManager::AddGamepad(const char* aID, uint32_t aMapping, uint32_t aHand,
uint32_t aNumButtons, uint32_t aNumAxes)
VRControllerManager::AddGamepad(const char* aID, dom::GamepadMappingType aMapping,
dom::GamepadHand aHand, uint32_t aNumButtons, uint32_t aNumAxes)
{
dom::GamepadAdded a(NS_ConvertUTF8toUTF16(nsDependentCString(aID)), mControllerCount,
aMapping, aHand, dom::GamepadServiceType::VR, aNumButtons,

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

@ -22,6 +22,7 @@ class PTextureParent;
}
namespace dom {
enum class GamepadMappingType : uint32_t;
enum class GamepadHand : uint32_t;
struct GamepadPoseState;
}
namespace gfx {
@ -219,14 +220,14 @@ struct VRControllerInfo
VRDeviceType GetType() const { return mType; }
uint32_t GetControllerID() const { return mControllerID; }
const nsCString& GetControllerName() const { return mControllerName; }
uint32_t GetMappingType() const { return mMappingType; }
dom::GamepadMappingType GetMappingType() const { return mMappingType; }
uint32_t GetNumButtons() const { return mNumButtons; }
uint32_t GetNumAxes() const { return mNumAxes; }
uint32_t mControllerID;
VRDeviceType mType;
nsCString mControllerName;
uint32_t mMappingType;
dom::GamepadMappingType mMappingType;
uint32_t mNumButtons;
uint32_t mNumAxes;
@ -258,8 +259,8 @@ public:
void NewButtonEvent(uint32_t aIndex, uint32_t aButton, bool aPressed);
void NewAxisMove(uint32_t aIndex, uint32_t aAxis, double aValue);
void NewPoseState(uint32_t aIndex, const dom::GamepadPoseState& aPose);
void AddGamepad(const char* aID, uint32_t aMapping, uint32_t aHand,
uint32_t aNumButtons, uint32_t aNumAxes);
void AddGamepad(const char* aID, dom::GamepadMappingType aMapping,
dom::GamepadHand aHand, uint32_t aNumButtons, uint32_t aNumAxes);
void RemoveGamepad(uint32_t aIndex);
protected:

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

@ -25,10 +25,8 @@
#include "nsIScreenManager.h"
#include "openvr/openvr.h"
#ifdef MOZ_GAMEPAD
#include "mozilla/dom/GamepadEventTypes.h"
#include "mozilla/dom/GamepadBinding.h"
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846
@ -490,9 +488,7 @@ VRControllerOpenVR::VRControllerOpenVR()
{
MOZ_COUNT_CTOR_INHERITED(VRControllerOpenVR, VRControllerHost);
mControllerInfo.mControllerName.AssignLiteral("OpenVR HMD");
#ifdef MOZ_GAMEPAD
mControllerInfo.mMappingType = static_cast<uint32_t>(GamepadMappingType::_empty);
#endif
mControllerInfo.mMappingType = GamepadMappingType::_empty;
mControllerInfo.mNumButtons = gNumOpenVRButtonMask;
mControllerInfo.mNumAxes = gNumOpenVRAxis;
}
@ -744,7 +740,6 @@ VRControllerManagerOpenVR::ScanForDevices()
// Re-adding controllers to VRControllerManager.
for (vr::TrackedDeviceIndex_t i = 0; i < newControllerCount; ++i) {
vr::TrackedDeviceIndex_t trackedDevice = trackedIndexArray[i];
#ifdef MOZ_GAMEPAD
vr::ETrackedControllerRole role =
mVRSystem->GetControllerRoleForTrackedDeviceIndex(trackedDevice);
GamepadHand hand;
@ -760,19 +755,15 @@ VRControllerManagerOpenVR::ScanForDevices()
hand = GamepadHand::Right;
break;
}
#endif
RefPtr<VRControllerOpenVR> openVRController = new VRControllerOpenVR();
openVRController->SetIndex(mControllerCount);
openVRController->SetTrackedIndex(trackedDevice);
mOpenVRController.AppendElement(openVRController);
// Only in MOZ_GAMEPAD platform, We add gamepads.
#ifdef MOZ_GAMEPAD
// Not already present, add it.
AddGamepad("OpenVR Gamepad", static_cast<uint32_t>(GamepadMappingType::_empty),
static_cast<uint32_t>(hand), gNumOpenVRButtonMask, gNumOpenVRAxis);
AddGamepad("OpenVR Gamepad", GamepadMappingType::_empty,
hand, gNumOpenVRButtonMask, gNumOpenVRAxis);
++mControllerCount;
#endif
}
}
}

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

@ -17,10 +17,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/layers/TextureClient.h"
#include "nsContentUtils.h"
#ifdef MOZ_GAMEPAD
#include "mozilla/dom/GamepadManager.h"
#endif
using layers::TextureClient;
@ -479,7 +476,6 @@ VRManagerChild::RecvNotifyVRVSync(const uint32_t& aDisplayID)
mozilla::ipc::IPCResult
VRManagerChild::RecvGamepadUpdate(const GamepadChangeEvent& aGamepadEvent)
{
#ifdef MOZ_GAMEPAD
// VRManagerChild could be at other processes, but GamepadManager
// only exists at the content process or the same process
// in non-e10s mode.
@ -489,7 +485,6 @@ VRManagerChild::RecvGamepadUpdate(const GamepadChangeEvent& aGamepadEvent)
if (gamepadManager) {
gamepadManager->Update(aGamepadEvent);
}
#endif
return IPC_OK();
}