mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 699741 - Do not check if the change is higher than 0.01 to send a levelchange event. r=cjones
This commit is contained in:
parent
0f9feaf9b3
commit
f5e2b5a571
@ -52,7 +52,6 @@ public class GeckoBatteryManager
|
||||
{
|
||||
private final static float kDefaultLevel = 1.0f;
|
||||
private final static boolean kDefaultCharging = true;
|
||||
private final static float kMinimumLevelChange = 0.01f;
|
||||
|
||||
private static boolean sNotificationsEnabled = false;
|
||||
private static float sLevel = kDefaultLevel;
|
||||
@ -96,14 +95,14 @@ public class GeckoBatteryManager
|
||||
/*
|
||||
* We want to inform listeners if the following conditions are fulfilled:
|
||||
* - we have at least one observer;
|
||||
* - the charging state has changed
|
||||
* OR
|
||||
* the level has changed of at least kMinimumLevelChange
|
||||
* - the charging state or the level has changed.
|
||||
*
|
||||
* The idea is to prevent doing all the way to the DOM code in the child
|
||||
* process to finally not send an event.
|
||||
*/
|
||||
if (sNotificationsEnabled &&
|
||||
(previousCharging != isCharging() ||
|
||||
Math.abs(previousLevel - getLevel()) >= kMinimumLevelChange)) {
|
||||
GeckoAppShell.notifyBatteryChange(sLevel, sCharging);
|
||||
(previousCharging != isCharging() || previousLevel != getLevel())) {
|
||||
GeckoAppShell.notifyBatteryChange(getLevel(), isCharging());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user