on xenial help sign in
Turn off animation when display is off
commit3c8fd5f29645247ea19c247483d5cd4a46849963 authorMichael Terry <michael.terry@canonical.com> dateWed 21 Aug 2013, 16:48 (13 years ago) parent58964f6
1 file changed+18
Components/DemoOverlay.qml+18
Components/DemoOverlay.qml+18
@@ -14,6 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17+import Powerd 0.1
1718import QtQuick 2.0
1819import QtGraphicalEffects 1.0
1920import Ubuntu.Application 0.1
@@ -243,4 +244,21 @@ Showable {
243244 }
244245 }
245246 }
247+
248+ // Watch display, so we can turn off animation if it does. No reason to
249+ // chew CPU when user isn't watching.
250+ Connections {
251+ id: powerConnection
252+ target: Powerd
253+
254+ onDisplayPowerStateChange: {
255+ if (status == Powerd.Off && wholeAnimation.running) {
256+ wholeAnimation.paused = true;
257+ //hintAnimation.paused = true;
258+ } else if (status == Powerd.On) {
259+ wholeAnimation.paused = false;
260+ //hintAnimation.paused = false;
261+ }
262+ }
263+ }
246264}