Resolved two issues:

1) While in HMD mode -> open Tablet -> Click Desktop.  Desktop mode will be on.
2) Menu sync problem while switching modes.
This commit is contained in:
NeetBhagat 2017-06-06 22:31:14 +05:30
parent ae9a928740
commit c3621d7c32
7 changed files with 22 additions and 23 deletions

View file

@ -1360,7 +1360,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
if (_autoSwitchDisplayModeSupportedHMDPlugin) { if (_autoSwitchDisplayModeSupportedHMDPlugin) {
if (getActiveDisplayPlugin() != _autoSwitchDisplayModeSupportedHMDPlugin && if (getActiveDisplayPlugin() != _autoSwitchDisplayModeSupportedHMDPlugin &&
!_autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) { !_autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
startHMDStandBySession(); startHMDStandBySession();
} }
// Poll periodically to check whether the user has worn HMD or not. Switch Display mode accordingly. // Poll periodically to check whether the user has worn HMD or not. Switch Display mode accordingly.
@ -1602,8 +1602,8 @@ void Application::aboutToQuit() {
getActiveDisplayPlugin()->deactivate(); getActiveDisplayPlugin()->deactivate();
if (_autoSwitchDisplayModeSupportedHMDPlugin if (_autoSwitchDisplayModeSupportedHMDPlugin
&& _autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) { && _autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
_autoSwitchDisplayModeSupportedHMDPlugin->endStandBySession(); _autoSwitchDisplayModeSupportedHMDPlugin->endSession();
} }
// use the CloseEventSender via a QThread to send an event that says the user asked for the app to close // use the CloseEventSender via a QThread to send an event that says the user asked for the app to close
auto closeEventSender = DependencyManager::get<CloseEventSender>(); auto closeEventSender = DependencyManager::get<CloseEventSender>();
@ -6827,13 +6827,14 @@ void Application::switchDisplayMode() {
// Switch to respective mode as soon as currentHMDWornStatus changes // Switch to respective mode as soon as currentHMDWornStatus changes
if (currentHMDWornStatus) { if (currentHMDWornStatus) {
qCDebug(interfaceapp) << "Switching from Desktop to HMD mode"; qCDebug(interfaceapp) << "Switching from Desktop to HMD mode";
endHMDStandBySession(); endHMDSession();
setActiveDisplayPlugin(_autoSwitchDisplayModeSupportedHMDPluginName); setActiveDisplayPlugin(_autoSwitchDisplayModeSupportedHMDPluginName);
} else { } else {
qCDebug(interfaceapp) << "Switching from HMD to desktop mode"; qCDebug(interfaceapp) << "Switching from HMD to desktop mode";
setActiveDisplayPlugin(DESKTOP_DISPLAY_PLUGIN_NAME); setActiveDisplayPlugin(DESKTOP_DISPLAY_PLUGIN_NAME);
startHMDStandBySession(); startHMDStandBySession();
} }
emit activeDisplayPluginChanged();
} }
_previousHMDWornStatus = currentHMDWornStatus; _previousHMDWornStatus = currentHMDWornStatus;
} }
@ -6842,8 +6843,8 @@ void Application::startHMDStandBySession() {
_autoSwitchDisplayModeSupportedHMDPlugin->startStandBySession(); _autoSwitchDisplayModeSupportedHMDPlugin->startStandBySession();
} }
void Application::endHMDStandBySession() { void Application::endHMDSession() {
_autoSwitchDisplayModeSupportedHMDPlugin->endStandBySession(); _autoSwitchDisplayModeSupportedHMDPlugin->endSession();
} }
mat4 Application::getEyeProjection(int eye) const { mat4 Application::getEyeProjection(int eye) const {

View file

@ -685,6 +685,6 @@ private:
QString _autoSwitchDisplayModeSupportedHMDPluginName; QString _autoSwitchDisplayModeSupportedHMDPluginName;
bool _previousHMDWornStatus; bool _previousHMDWornStatus;
void startHMDStandBySession(); void startHMDStandBySession();
void endHMDStandBySession(); void endHMDSession();
}; };
#endif // hifi_Application_h #endif // hifi_Application_h

View file

@ -346,9 +346,9 @@ bool OpenGLDisplayPlugin::startStandBySession() {
return Parent::startStandBySession(); return Parent::startStandBySession();
} }
void OpenGLDisplayPlugin::endStandBySession() { void OpenGLDisplayPlugin::endSession() {
deactivateStandBySession(); deactivateSession();
Parent::endStandBySession(); Parent::endSession();
} }
void OpenGLDisplayPlugin::customizeContext() { void OpenGLDisplayPlugin::customizeContext() {

View file

@ -43,7 +43,7 @@ public:
bool activate() override final; bool activate() override final;
void deactivate() override final; void deactivate() override final;
bool startStandBySession() override final; bool startStandBySession() override final;
void endStandBySession() override final; void endSession() override final;
bool eventFilter(QObject* receiver, QEvent* event) override; bool eventFilter(QObject* receiver, QEvent* event) override;
bool isDisplayVisible() const override { return true; } bool isDisplayVisible() const override { return true; }
@ -104,7 +104,7 @@ protected:
// Returns true on successful activation of standby session // Returns true on successful activation of standby session
virtual bool activateStandBySession() { return true; } virtual bool activateStandBySession() { return true; }
virtual void deactivateStandBySession() {} virtual void deactivateSession() {}
// Plugin specific functionality to send the composed scene to the output window or device // Plugin specific functionality to send the composed scene to the output window or device
virtual void internalPresent(); virtual void internalPresent();

View file

@ -54,16 +54,16 @@ public:
return _active; return _active;
} }
virtual bool startStandBySession() { virtual bool startStandBySession() {
_standbysessionstatus = true; _sessionStatus = true;
return _standbysessionstatus; return _sessionStatus;
} }
virtual void endStandBySession() { virtual void endSession() {
_standbysessionstatus = false; _sessionStatus = false;
} }
virtual bool isStandBySessionActive() { virtual bool isSessionActive() {
return _standbysessionstatus; return _sessionStatus;
} }
/** /**
@ -85,7 +85,7 @@ signals:
protected: protected:
bool _active { false }; bool _active { false };
bool _standbysessionstatus { false }; bool _sessionStatus { false };
PluginContainer* _container { nullptr }; PluginContainer* _container { nullptr };
static const char* UNKNOWN_PLUGIN_ID; static const char* UNKNOWN_PLUGIN_ID;

View file

@ -123,8 +123,6 @@ bool OculusBaseDisplayPlugin::internalActivate() {
void OculusBaseDisplayPlugin::internalDeactivate() { void OculusBaseDisplayPlugin::internalDeactivate() {
Parent::internalDeactivate(); Parent::internalDeactivate();
releaseOculusSession();
_session = nullptr;
} }
bool OculusBaseDisplayPlugin::activateStandBySession() { bool OculusBaseDisplayPlugin::activateStandBySession() {
@ -134,7 +132,7 @@ bool OculusBaseDisplayPlugin::activateStandBySession() {
} }
return true; return true;
} }
void OculusBaseDisplayPlugin::deactivateStandBySession() { void OculusBaseDisplayPlugin::deactivateSession() {
releaseOculusSession(); releaseOculusSession();
_session = nullptr; _session = nullptr;
} }

View file

@ -35,7 +35,7 @@ protected:
bool internalActivate() override; bool internalActivate() override;
void internalDeactivate() override; void internalDeactivate() override;
bool activateStandBySession() override; bool activateStandBySession() override;
void deactivateStandBySession() override; void deactivateSession() override;
void updatePresentPose() override; void updatePresentPose() override;
protected: protected: