[Pkg-wmaker-commits] [wmbattery] 35/241: * Deal with -1 time left from apm (no estimate). * Never dim colon, fixes display bug.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:37:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmbattery.

commit 8cc63beb53f3df69ac682edea36cf94e15a881c8
Author: joey <joey at a4a2c43b-8ac3-0310-8836-e0e880c912e2>
Date:   Mon Apr 22 16:33:26 2002 +0000

       * Deal with -1 time left from apm (no estimate).
       * Never dim colon, fixes display bug.
---
 acpi.c           |  2 +-
 debian/changelog |  7 +++++++
 wmbattery.c      | 42 +++++++++++++++++++++++-------------------
 3 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/acpi.c b/acpi.c
index d945dcd..cbc7101 100644
--- a/acpi.c
+++ b/acpi.c
@@ -105,7 +105,7 @@ int find_items (char *itemname, char infoarray[ACPI_MAXITEM][128],
 	
 	dir = opendir(itemname);
 	if (dir == NULL)
-		return -1;
+		return 0;
 
 	while ((ent = readdir(dir))) {
 		if (!strncmp(".", ent->d_name, 1) || 
diff --git a/debian/changelog b/debian/changelog
index c0da9e9..54fb13b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+wmbattery (2.06) unstable; urgency=low
+
+  * Deal with -1 time left from apm (no estimate).
+  * Never dim colon, fixes display bug.
+
+ -- Joey Hess <joeyh at debian.org>  Mon, 22 Apr 2002 12:30:35 -0400
+
 wmbattery (2.05) unstable; urgency=low
 
   * (acpi) don't display the rather wacky "- :0" on an almost full battery
diff --git a/wmbattery.c b/wmbattery.c
index c8e777e..0181a80 100644
--- a/wmbattery.c
+++ b/wmbattery.c
@@ -324,6 +324,24 @@ void recalc_window(apm_info cur_info) {
 		   image_info[DIAL_DIM].x + x,
 		   image_info[DIAL_DIM].y);
   
+	/* Show percent remaining */
+      	if (cur_info.battery_percentage >= 0) {
+        	digit = cur_info.battery_percentage / 10;
+       		if (digit == 10) {
+		  	/* 11 is the `1' for the hundreds place. */
+	  		draw_letter(11,SMALLFONT,HUNDREDS_OFFSET);
+	  		digit=0;
+		}
+		draw_letter(digit,SMALLFONT,TENS_OFFSET);
+		digit = cur_info.battery_percentage % 10;
+		draw_letter(digit,SMALLFONT,ONES_OFFSET);
+      	}
+  	else {
+	  	/* There is no battery, so we need to dim out the
+		 * percent sign that is normally bright. */
+	  	draw_letter(10,SMALLFONT,PERCENT_OFFSET);
+	}
+
       	/* Show time left */
         if (cur_info.using_minutes)
         	time_left = cur_info.battery_time;
@@ -346,25 +364,6 @@ void recalc_window(apm_info cur_info) {
         digit = min_left % 10;
         draw_letter(digit,BIGFONT,MINUTES_ONES_OFFSET);
       	
-	/* Show percent remaining */
-      	if (cur_info.battery_percentage >= 0) {
-        	digit = cur_info.battery_percentage / 10;
-       		if (digit == 10) {
-		  	/* 11 is the `1' for the hundreds place. */
-	  		draw_letter(11,SMALLFONT,HUNDREDS_OFFSET);
-	  		digit=0;
-		}
-		draw_letter(digit,SMALLFONT,TENS_OFFSET);
-		digit = cur_info.battery_percentage % 10;
-		draw_letter(digit,SMALLFONT,ONES_OFFSET);
-      	}
-  	else {
-	  	/* There is no battery, so we need to dim out the
-		 * colon and percent sign that are normally bright. */
-	  	draw_letter(10,SMALLFONT,PERCENT_OFFSET);
-	  	draw_letter(10,BIGFONT,COLON_OFFSET);
-	}
-
 	redraw_window();
 }
 
@@ -378,6 +377,11 @@ void alarmhandler(int sig) {
 	else if (! use_sonypi) {
 		if (apm_read(&cur_info) != 0)
 			error("Cannot read APM information.");
+		/* Apm uses negative numbers here to indicate error or
+		 * missing battery or something. I use it for time
+		 * remaining in ACPI, so.. */
+		if (cur_info.battery_time < 0)
+			cur_info.battery_time = 0;
 	}
 	else {
 		if (sonypi_read(&cur_info) != 0)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbattery.git



More information about the Pkg-wmaker-commits mailing list