Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move screen.enabled/brightness to power manager interface

  • Loading branch information...
commit c1a197b23ccb8f21f816a449ba2dd432a3a37fb1 1 parent a1ec0b7
@kanru kanru authored
View
30 apps/homescreen/js/homescreen.js
@@ -236,7 +236,7 @@ var LockScreen = {
break;
case 'keydown':
- if (e.keyCode != e.DOM_VK_SLEEP || !screen.mozEnabled)
+ if (e.keyCode != e.DOM_VK_SLEEP || !navigator.mozPower.screenEnabled)
return;
this._timeout = window.setTimeout(function() {
@@ -249,7 +249,7 @@ var LockScreen = {
return;
window.clearTimeout(this._timeout);
- if (screen.mozEnabled) {
+ if (navigator.mozPower.screenEnabled) {
this.update(function lockScreenCallback() {
ScreenManager.turnScreenOff();
});
@@ -497,7 +497,7 @@ var NotificationScreen = {
// Update the clock and schedule a new update if appropriate
function updateClock() {
- if (!screen.mozEnabled)
+ if (!navigator.mozPower.screenEnabled)
return;
var now = new Date();
@@ -519,7 +519,7 @@ function updateBattery() {
return;
// If the display is off, there is nothing to do here
- if (!screen.mozEnabled) {
+ if (!navigator.mozPower.screenEnabled) {
battery.removeEventListener('chargingchange', updateBattery);
battery.removeEventListener('levelchange', updateBattery);
battery.removeEventListener('statuschange', updateBattery);
@@ -563,7 +563,7 @@ function updateConnection() {
return;
}
- if (!screen.mozEnabled) {
+ if (!navigator.mozPower.screenEnabled) {
conn.removeEventListener('cardstatechange', updateConnection);
conn.removeEventListener('connectionchange', updateConnection);
return;
@@ -912,7 +912,7 @@ var KeyHandler = {
},
handleEvent: function kh_handleEvent(evt) {
- if (!screen.mozEnabled)
+ if (!navigator.mozPower.screenEnabled)
return;
switch (evt.type) {
@@ -966,20 +966,20 @@ window.addEventListener('keyup', KeyHandler);
var ScreenManager = {
preferredBrightness: 0.5,
toggleScreen: function lockscreen_toggleScreen() {
- if (screen.mozEnabled)
+ if (navigator.mozPower.screenEnabled)
this.turnScreenOff();
else
this.turnScreenOn();
},
turnScreenOff: function lockscreen_turnScreenOff() {
- if (!screen.mozEnabled)
+ if (!navigator.mozPower.screenEnabled)
return false;
- screen.mozEnabled = false;
+ navigator.mozPower.screenEnabled = false;
- this.preferredBrightness = screen.mozBrightness;
- screen.mozBrightness = 0.0;
+ this.preferredBrightness = navigator.mozPower.screenBrightness;
+ navigator.mozPower.screenBrightness = 0.0;
updateClock();
updateBattery();
@@ -989,12 +989,12 @@ var ScreenManager = {
},
turnScreenOn: function lockscreen_turnScreenOn() {
- if (screen.mozEnabled)
+ if (navigator.mozPower.screenEnabled)
return false;
- screen.mozEnabled = true;
+ navigator.mozPower.screenEnabled = true;
- screen.mozBrightness = this.preferredBrightness;
+ navigator.mozPower.screenBrightness = this.preferredBrightness;
updateClock();
updateBattery();
@@ -1005,7 +1005,7 @@ var ScreenManager = {
};
SettingsListener.observe('screen.brightness', 0.5, function(value) {
- ScreenManager.preferredBrightness = screen.mozBrightness = parseFloat(value);
+ ScreenManager.preferredBrightness = navigator.mozPower.screenBrightness = parseFloat(value);
});
/* === MessagesListener === */
View
2  apps/settings/js/settings.js
@@ -80,7 +80,7 @@ var Settings = {
var position = Math.ceil((evt.clientX - rect.left) / (rect.width / 10));
var value = position / input.max;
- screen.mozBrightness = value;
+ navigator.mozPower.screenBrightness = value;
input.value = position;
var cset = { }; cset[key] = value;
View
2  apps/settings/js/wifi.js
@@ -84,7 +84,7 @@ window.addEventListener('localized', function scanWifiNetworks(evt) {
// scan wifi networks and display them in the list
function scan() {
- if (!wifiManager.enabled || !screen.mozEnabled || scanning)
+ if (!wifiManager.enabled || !navigator.mozPower.screenEnabled || scanning)
return;
var req = wifiManager.getNetworks();
View
2  tests/head.js
@@ -132,7 +132,7 @@ function testApp(url, testfunc) {
// Send the Home key to turn the screen on if it was off
EventUtils.sendKey('HOME', contentWin);
- silentOK(screen.mozEnabled, 'screen not on');
+ silentOK(navigator.mozPower.screenEnabled, 'screen not on');
// Unlock the screen
// FIXME: I used to do this by sending swipe events, but it broke
Please sign in to comment.
Something went wrong with that request. Please try again.