瀏覽代碼

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;