diff options
author | Garrett Brown <themagnificentmrb@gmail.com> | 2018-03-28 10:00:00 +0200 |
---|---|---|
committer | Garrett Brown <themagnificentmrb@gmail.com> | 2018-04-02 14:42:48 -0700 |
commit | f5a7a5b24848e6e30b721cc910417fed955c7949 (patch) | |
tree | 7d8d383d15b18789ffcc020b82a69e1ddf09dcb2 | |
parent | c71bd621e4a4a6ab94b7c7b389623a571c2999dd (diff) |
Improve logic in CApplication::CheckScreenSaverAndDPMS()
-rw-r--r-- | xbmc/Application.cpp | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 1f3174e450..87ef85b413 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3757,20 +3757,37 @@ void CApplication::CheckOSScreenSaverInhibitionSetting() void CApplication::CheckScreenSaverAndDPMS() { - bool maybeScreensaver = - !m_dpmsIsActive && !m_screensaverActive - && !m_ServiceManager->GetSettings().GetString(CSettings::SETTING_SCREENSAVER_MODE).empty(); - bool maybeDPMS = - !m_dpmsIsActive && m_dpms->IsSupported() - && m_ServiceManager->GetSettings().GetInt(CSettings::SETTING_POWERMANAGEMENT_DISPLAYSOFF) > 0; + bool maybeScreensaver = true; + if (m_dpmsIsActive) + maybeScreensaver = false; + else if (m_screensaverActive) + maybeScreensaver = false; + else if (m_ServiceManager->GetSettings().GetString(CSettings::SETTING_SCREENSAVER_MODE).empty()) + maybeScreensaver = false; + + bool maybeDPMS = true; + if (m_dpmsIsActive) + maybeDPMS = false; + else if (!m_dpms->IsSupported()) + maybeDPMS = false; + else if (m_ServiceManager->GetSettings().GetInt(CSettings::SETTING_POWERMANAGEMENT_DISPLAYSOFF) <= 0) + maybeDPMS = false; + // whether the current state of the application should be regarded as active even when there is no // explicit user activity such as input - bool haveIdleActivity = - // * Are we playing a video and it is not paused? - (m_appPlayer.IsPlayingVideo() && !m_appPlayer.IsPaused()) - // * Are we playing some music in fullscreen vis? - || (m_appPlayer.IsPlayingAudio() && CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_VISUALISATION - && !m_ServiceManager->GetSettings().GetString(CSettings::SETTING_MUSICPLAYER_VISUALISATION).empty()); + bool haveIdleActivity = false; + + // Are we playing a video and it is not paused? + if (m_appPlayer.IsPlayingVideo() && !m_appPlayer.IsPaused()) + haveIdleActivity = true; + + // Are we playing some music in fullscreen vis? + else if (m_appPlayer.IsPlayingAudio() && + CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_VISUALISATION && + !m_ServiceManager->GetSettings().GetString(CSettings::SETTING_MUSICPLAYER_VISUALISATION).empty()) + { + haveIdleActivity = true; + } // Handle OS screen saver state if (haveIdleActivity && CServiceBroker::GetWinSystem().GetOSScreenSaver()) |