[Xfce4-commits] [panel-plugins/xfce4-battery-plugin] 07/07: Reset averages when a battery is removed/added (Bug #14930).
noreply at xfce.org
noreply at xfce.org
Sun Dec 2 22:36:34 CET 2018
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-battery-plugin.
commit 2417d8ef81c5b7f2d519a90f1a1c67a0a8138047
Author: John Lindgren <john at jlindgren.net>
Date: Sat Dec 1 00:47:23 2018 -0500
Reset averages when a battery is removed/added (Bug #14930).
---
panel-plugin/battery.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/panel-plugin/battery.c b/panel-plugin/battery.c
index 5ed0dd2..c516742 100644
--- a/panel-plugin/battery.c
+++ b/panel-plugin/battery.c
@@ -177,6 +177,7 @@ update_apm_status(t_battmon *battmon)
static int last_lcapacity = 0;
static int last_rate = 0;
static int last_acline = 0;
+ static int last_present = 0;
#if defined(__OpenBSD__) || defined(__NetBSD__)
/* Code for OpenBSD by Joe Ammond <jra at twinight.org>. Using the same
@@ -207,7 +208,7 @@ update_apm_status(t_battmon *battmon)
for (i=0;i<batt_count;i++) {
if ( !read_acpi_info(i) || !read_acpi_state(i) )
continue;
- present = 1;
+ present++;
lcapacity += acpiinfo->last_full_capacity;
ccapacity += acpistate->rcapacity;
rate += acpistate->prate;
@@ -218,8 +219,8 @@ update_apm_status(t_battmon *battmon)
sum_rate += rate;
update_time++;
- if ( update_time >= AVERAGING_CYCLE || last_acline != acline ) {
- if ( last_acline != acline ) {
+ if ( update_time >= AVERAGING_CYCLE || last_acline != acline || last_present != present ) {
+ if ( last_acline != acline || last_present != present ) {
last_ccapacity = ccapacity;
last_lcapacity = lcapacity;
last_rate = rate;
@@ -247,6 +248,7 @@ update_apm_status(t_battmon *battmon)
time_remaining = 0;
last_acline = acline;
+ last_present = present;
}
#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list