Don't allow leaving VR mode to target the rift

This commit is contained in:
Bradley Austin Davis 2015-07-30 17:40:02 -07:00
parent ac0ec0a458
commit f3e701e0d5
2 changed files with 12 additions and 2 deletions

View file

@ -197,6 +197,13 @@ void HMDToolsDialog::centerCursorOnWidget(QWidget* widget) {
void HMDToolsDialog::showEvent(QShowEvent* event) {
// center the cursor on the hmd tools dialog
centerCursorOnWidget(this);
if (qApp->isHMDMode()) {
_inHDMMode = true;
_switchModeButton->setText("Leave HMD Mode");
} else {
_inHDMMode = false;
_switchModeButton->setText("Enter HMD Mode");
}
}
void HMDToolsDialog::hideEvent(QHideEvent* event) {

View file

@ -116,7 +116,11 @@ void Oculus_0_5_DisplayPlugin::deactivate(PluginContainer* container) {
OculusBaseDisplayPlugin::deactivate(container);
container->unsetFullscreen();
QScreen* riftScreen = nullptr;
if (_hmdScreen >= 0) {
riftScreen = qApp->screens()[_hmdScreen];
}
container->unsetFullscreen(riftScreen);
ovrHmd_Destroy(_hmd);
_hmd = nullptr;
@ -140,7 +144,6 @@ void Oculus_0_5_DisplayPlugin::display(GLuint finalTexture, const glm::uvec2& sc
ovrHmd_EndFrame(_hmd, _eyePoses, _eyeTextures);
}
bool _hswDismissed{false};
// Pass input events on to the application
bool Oculus_0_5_DisplayPlugin::eventFilter(QObject* receiver, QEvent* event) {
if (!_hswDismissed && (event->type() == QEvent::KeyPress)) {