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 (getActiveDisplayPlugin() != _autoSwitchDisplayModeSupportedHMDPlugin &&
!_autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) {
!_autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
startHMDStandBySession();
}
// 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();
if (_autoSwitchDisplayModeSupportedHMDPlugin
&& _autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) {
_autoSwitchDisplayModeSupportedHMDPlugin->endStandBySession();
&& _autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
_autoSwitchDisplayModeSupportedHMDPlugin->endSession();
}
// 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>();
@ -6827,13 +6827,14 @@ void Application::switchDisplayMode() {
// Switch to respective mode as soon as currentHMDWornStatus changes
if (currentHMDWornStatus) {
qCDebug(interfaceapp) << "Switching from Desktop to HMD mode";
endHMDStandBySession();
endHMDSession();
setActiveDisplayPlugin(_autoSwitchDisplayModeSupportedHMDPluginName);
} else {
qCDebug(interfaceapp) << "Switching from HMD to desktop mode";
setActiveDisplayPlugin(DESKTOP_DISPLAY_PLUGIN_NAME);
startHMDStandBySession();
}
emit activeDisplayPluginChanged();
}
_previousHMDWornStatus = currentHMDWornStatus;
}
@ -6842,8 +6843,8 @@ void Application::startHMDStandBySession() {
_autoSwitchDisplayModeSupportedHMDPlugin->startStandBySession();
}
void Application::endHMDStandBySession() {
_autoSwitchDisplayModeSupportedHMDPlugin->endStandBySession();
void Application::endHMDSession() {
_autoSwitchDisplayModeSupportedHMDPlugin->endSession();
}
mat4 Application::getEyeProjection(int eye) const {

View file

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

View file

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

View file

@ -43,7 +43,7 @@ public:
bool activate() override final;
void deactivate() override final;
bool startStandBySession() override final;
void endStandBySession() override final;
void endSession() override final;
bool eventFilter(QObject* receiver, QEvent* event) override;
bool isDisplayVisible() const override { return true; }
@ -104,7 +104,7 @@ protected:
// Returns true on successful activation of standby session
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
virtual void internalPresent();

View file

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

View file

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

View file

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