소스 검색

By default allow sleep in fullscreen as well.

We have now introduced a new hidden setting called main.preventSystemScreensaver
that defaults to false. When set to true the old behavior will be
in effect (not allowing the screensaver and sleep when PMP is in fullscreen)
the new default behavior is to allow the screensaver and sleep
when PMP is in fullscreen.
Tobias Hieta 8 년 전
부모
커밋
40a8811711
2개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 0
      resources/settings/settings_description.json
  2. 8 1
      src/power/PowerComponent.cpp

+ 5 - 0
resources/settings/settings_description.json

@@ -108,6 +108,11 @@
           }
         ],
         "hidden": true
+      },
+      {
+        "value": "preventSystemScreensaver",
+        "default": false,
+        "hidden": true
       }
     ]
   },

+ 8 - 1
src/power/PowerComponent.cpp

@@ -60,7 +60,14 @@ void PowerComponent::setFullscreenState(bool fullscreen)
 /////////////////////////////////////////////////////////////////////////////////////////
 void PowerComponent::redecideScreeensaverState()
 {
-  bool enableOsScreensaver = !m_fullscreenState && !m_videoPlaying;
+  bool enableOsScreensaver = !m_videoPlaying;
+
+  // by default we don't allow the fullscreen state affect sleep state, but we want to
+  // have a hidden option to allow system sleep and screensaver when in fullscreen.
+  //
+  if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "preventSystemScreensaver").toBool())
+    enableOsScreensaver &= !m_fullscreenState;
+
   if (m_currentScreensaverEnabled != enableOsScreensaver)
   {
     m_currentScreensaverEnabled = enableOsScreensaver;