diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 49c2e17d84..60c9de1223 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5144,13 +5144,6 @@ void Application::updateDisplayMode() { QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) { resizeGL(); }); - QObject::connect(displayPlugin.get(), &DisplayPlugin::outputDeviceLost, [this, displayPluginName] { - PluginManager::getInstance()->disableDisplayPlugin(displayPluginName); - auto menu = Menu::getInstance(); - if (menu->menuItemExists(MenuOption::OutputMenu, displayPluginName)) { - menu->removeMenuItem(MenuOption::OutputMenu, displayPluginName); - } - }); first = false; } diff --git a/libraries/plugins/src/plugins/DisplayPlugin.h b/libraries/plugins/src/plugins/DisplayPlugin.h index 1f6a16cd46..19f803e11e 100644 --- a/libraries/plugins/src/plugins/DisplayPlugin.h +++ b/libraries/plugins/src/plugins/DisplayPlugin.h @@ -170,10 +170,6 @@ public: signals: void recommendedFramebufferSizeChanged(const QSize & size); - // Indicates that this display plugin is no longer valid for use. - // For instance if a user exits Oculus Home or Steam VR while - // using the corresponding plugin, that plugin should be disabled. - void outputDeviceLost(); protected: void incrementPresentCount(); diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index fe406cc29a..3e7e5abbf3 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -128,10 +128,7 @@ void OpenVrDisplayPlugin::resetSensors() { bool OpenVrDisplayPlugin::beginFrameRender(uint32_t frameIndex) { handleOpenVrEvents(); - if (openVrQuitRequested()) { - emit outputDeviceLost(); - return false; - } + double displayFrequency = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float); double frameDuration = 1.f / displayFrequency; double vsyncToPhotons = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SecondsFromVsyncToPhotons_Float); diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 155bc9f079..3c765c3fa8 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -26,11 +26,6 @@ using Lock = std::unique_lock; static int refCount { 0 }; static Mutex mutex; static vr::IVRSystem* activeHmd { nullptr }; -static bool _openVrQuitRequested { false }; - -bool openVrQuitRequested() { - return _openVrQuitRequested; -} static const uint32_t RELEASE_OPENVR_HMD_DELAY_MS = 5000; @@ -84,7 +79,6 @@ void releaseOpenVrSystem() { if (0 == refCount) { qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system"; vr::VR_Shutdown(); - _openVrQuitRequested = false; activeHmd = nullptr; } } @@ -103,14 +97,14 @@ void handleOpenVrEvents() { while (activeHmd->PollNextEvent(&event, sizeof(event))) { switch (event.eventType) { case vr::VREvent_Quit: - _openVrQuitRequested = true; activeHmd->AcknowledgeQuit_Exiting(); + QMetaObject::invokeMethod(qApp, "quit"); break; default: break; } - qDebug() << "OpenVR: Event " << event.eventType; + qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")"; } } diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index a7a0a2f56f..b862aacb06 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -214,10 +214,6 @@ void ViveControllerManager::renderHand(const controller::Pose& pose, gpu::Batch& void ViveControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) { auto userInputMapper = DependencyManager::get(); handleOpenVrEvents(); - if (openVrQuitRequested()) { - deactivate(); - return; - } // because update mutates the internal state we need to lock userInputMapper->withLock([&, this]() {