Browse Source

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 years ago
parent
commit
40a8811711
2 changed files with 13 additions and 1 deletions
  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;