summaryrefslogtreecommitdiffstats
path: root/desktop/lxpanel/patches/battery-applet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/lxpanel/patches/battery-applet.patch')
-rw-r--r--desktop/lxpanel/patches/battery-applet.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/desktop/lxpanel/patches/battery-applet.patch b/desktop/lxpanel/patches/battery-applet.patch
new file mode 100644
index 0000000000..c2f5b93007
--- /dev/null
+++ b/desktop/lxpanel/patches/battery-applet.patch
@@ -0,0 +1,31 @@
+From 93d9373574fcb0ed63cc4be7807343b018daad1a Mon Sep 17 00:00:00 2001
+From: Marty Jack <martyj@linux.local>
+Date: Thu, 19 Aug 2010 22:52:44 -0400
+Subject: [PATCH] Battery percentage incorrectly always evaluates as 100 percent (Bug3006059)
+
+---
+ src/plugins/batt/batt_sys.c | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/batt/batt_sys.c b/src/plugins/batt/batt_sys.c
+index 3c325b8..2ece803 100644
+--- a/src/plugins/batt/batt_sys.c
++++ b/src/plugins/batt/batt_sys.c
+@@ -150,7 +150,7 @@ void battery_update( battery *b ) {
+ b->state = "available";
+ }
+ else if ( strcmp("energy_now", sys_file ) == 0 ) {
+- b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000;
++ b->remaining_energy = get_unit_value((gchar*) file_content) / 1000;
+ if (!b->state)
+ b->state = "available";
+ }
+@@ -215,7 +215,7 @@ void battery_update( battery *b ) {
+ if (b->last_capacity < MIN_CAPACITY)
+ b->percentage = 0;
+ else
+- b->percentage = b->remaining_capacity * 100 / b->last_capacity;
++ b->percentage = ((float) b->remaining_energy * 100.0) / (float) b->last_capacity_unit;
+
+ if (b->percentage > 100)
+ b->percentage = 100;