forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1631635 - Implement IsPositionEmulated for XRInputSource. r=kip,i…
…manol Differential Revision: https://phabricator.services.mozilla.com/D71678
- Loading branch information
1 parent
92bbbc4
commit 2b669b7
Showing
14 changed files
with
145 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "XRInputSpace.h" | ||
|
||
namespace mozilla { | ||
namespace dom { | ||
|
||
XRInputSpace::XRInputSpace(nsIGlobalObject* aParent, XRSession* aSession, | ||
XRNativeOrigin* aNativeOrigin, | ||
int32_t aControllerIndex) | ||
: XRSpace(aParent, aSession, aNativeOrigin), mIndex(aControllerIndex) {} | ||
|
||
bool XRInputSpace::IsPositionEmulated() const { | ||
gfx::VRDisplayClient* display = mSession->GetDisplayClient(); | ||
if (!display) { | ||
// When there are no sensors, the position is considered emulated. | ||
return true; | ||
} | ||
const gfx::VRDisplayInfo& displayInfo = display->GetDisplayInfo(); | ||
const gfx::VRControllerState& controllerState = | ||
displayInfo.mControllerState[mIndex]; | ||
MOZ_ASSERT(controllerState.controllerName[0] != '\0'); | ||
|
||
return ( | ||
(controllerState.flags & GamepadCapabilityFlags::Cap_PositionEmulated) != | ||
GamepadCapabilityFlags::Cap_None); | ||
} | ||
|
||
} // namespace dom | ||
} // namespace mozilla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef mozilla_dom_XRInputSpace_h_ | ||
#define mozilla_dom_XRInputSpace_h_ | ||
|
||
#include "XRInputSpace.h" | ||
|
||
namespace mozilla { | ||
namespace dom { | ||
|
||
class XRInputSpace : public XRSpace { | ||
public: | ||
explicit XRInputSpace(nsIGlobalObject* aParent, XRSession* aSession, | ||
XRNativeOrigin* aNativeOrigin, | ||
int32_t aControllerIndex); | ||
|
||
virtual bool IsPositionEmulated() const override; | ||
|
||
protected: | ||
virtual ~XRInputSpace() = default; | ||
|
||
private: | ||
int32_t mIndex; | ||
}; | ||
|
||
} // namespace dom | ||
} // namespace mozilla | ||
|
||
#endif // mozilla_dom_XRInputSpace_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters