[Pkg-wmaker-commits] [wmacpi] 53/105: Imported Debian patch 2.2~rc1-3

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 18 01:13:44 UTC 2015


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

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

commit 3a34332a16565f74a4709178c716bb5eddb0f5d3
Author: Julien BLACHE <jblache at debian.org>
Date:   Sun Feb 10 18:37:35 2008 +0100

    Imported Debian patch 2.2~rc1-3
---
 debian/changelog                                   |  13 +
 debian/control                                     |   9 +-
 debian/copyright                                   |   9 +-
 debian/patches/00list                              |   1 +
 .../patches/01_power_supply_and_misc_fixes.dpatch  | 970 +++++++++++++++++++++
 5 files changed, 994 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 97e1cce..0893653 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+wmacpi (2.2~rc1-3) unstable; urgency=low
+
+  * debian/patches/01_power_supply_and_misc_fixes.dpatch:
+    + Added; add support for the power_supply class for 2.6.24+ and other misc
+      fixes (mostly graphical glitches) (closes: #463446).
+  * debian/control:
+    + Bump Standards-Version to 3.7.3 (no changes).
+    + Move homepage to Homepage: field.
+  * debian/copyright:
+    + Added proper copyrights.
+
+ -- Julien BLACHE <jblache at debian.org>  Sun, 10 Feb 2008 18:37:35 +0100
+
 wmacpi (2.2~rc1-2) unstable; urgency=low
 
   * debian/menu:
diff --git a/debian/control b/debian/control
index 23f8013..6989c36 100644
--- a/debian/control
+++ b/debian/control
@@ -3,8 +3,9 @@ Section: x11
 Priority: extra
 Maintainer: Julien BLACHE <jblache at debian.org>
 Build-Depends: debhelper (>= 5), dpatch, libx11-dev, libxpm-dev, x11proto-core-dev,
- x11proto-xext-dev, libdockapp-dev (>= 1:0.5.0-1)
-Standards-Version: 3.7.2
+ x11proto-xext-dev, libdockapp-dev (>= 1:0.5.0)
+Standards-Version: 3.7.3
+Homepage: http://himi.org/wmacpi/
 
 Package: wmacpi
 Architecture: i386 amd64
@@ -14,6 +15,4 @@ Description: ACPI battery monitor for WindowMaker
  This is a battery monitor that uses ACPI to query the battery status.
  This version should work with all recent kernels (vanilla > 2.4.21), both
  2.4.x and 2.6.x.
- .
-  Author: Simon Fowler <simon at dreamcraft.com.au>
-  Homepage: http://himi.org/wmacpi/
+  
diff --git a/debian/copyright b/debian/copyright
index a2f0470..ad44a81 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -12,9 +12,12 @@ were downloaded from <http://www.ne.jp/asahi/linux/timecop/>).
 
 Upstream authors:
 
-    Tim Copperfield <timecop at japan.co.jp>, original version (<= 1.34).
-    Simon Fowler <simon at himi.org>, rewritten version to work with
-        recent Linux kernels (vanilla > 2.4.21).
+    Copyright (C) 2000, 2001, 2002 timecop at japan.co.jp
+      Tim Copperfield <timecop at japan.co.jp>, original version (<= 1.34).
+
+    Copyright (C) 2003-2007 Simon Fowler <simon at himi.org>
+       Simon Fowler <simon at himi.org>, rewritten version to work with
+       recent Linux kernels (vanilla > 2.4.21).
 
 License:
 
diff --git a/debian/patches/00list b/debian/patches/00list
index 1ce3910..5e0ba4c 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -1 +1,2 @@
+01_power_supply_and_misc_fixes
 10_man_no_acpi
diff --git a/debian/patches/01_power_supply_and_misc_fixes.dpatch b/debian/patches/01_power_supply_and_misc_fixes.dpatch
new file mode 100644
index 0000000..26b25c2
--- /dev/null
+++ b/debian/patches/01_power_supply_and_misc_fixes.dpatch
@@ -0,0 +1,970 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_power_supply_and_misc_fixes.dpatch by  <jblache at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Add support for the power_supply class for 2.6.24+ and fix various
+## DP: little things, mainly graphical glitches.
+
+ at DPATCH@
+diff -urNad wmacpi-2.2~rc1~/libacpi.c wmacpi-2.2~rc1/libacpi.c
+--- wmacpi-2.2~rc1~/libacpi.c	2007-07-13 17:26:30.000000000 +0200
++++ wmacpi-2.2~rc1/libacpi.c	2008-02-10 18:30:18.958898787 +0100
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <ctype.h>
+ #include <stdlib.h>
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <time.h>
+@@ -11,13 +12,117 @@
+ #include "libacpi.h"
+ 
+ extern char *state[];
+-/* extern global_t *globals; */
++
++#define PROC_DATA_SOURCE    0
++#define SYSFS_DATA_SOURCE   1
++static int data_source;
+ 
+ /* local proto */
+ int acpi_get_design_cap(int batt);
+ 
++static int read_sysfs_file(char *node, char *prop, char *buf, size_t buflen)
++{
++  char tmp[256];
++  FILE *fp;
++  int ret;
++
++  ret = snprintf(tmp, sizeof(tmp), "/sys/class/power_supply/%s/%s", node, prop);
++  if (ret >= (int)sizeof(tmp)) {
++    perr("Path too long for %s/%s\n", node, prop);
++    return -1;
++  }
++
++  fp = fopen(tmp, "r");
++  if (fp == NULL) {
++    perr("Could not open %s/%s\n", node, prop);
++    return -2;
++  }
++
++  ret = fread(buf, 1, buflen - 1, fp);
++
++  fclose(fp);
++
++  if (ret == 0) {
++    perr("Could not read %s/%s\n", node, prop);
++    return -3;
++  }
++  
++  buf[ret] = '\0';
++
++  return 0;
++}
++
+ /* initialise the batteries */
+-int init_batteries(global_t *globals)
++static int sysfs_init_batteries(global_t *globals)
++{
++    DIR *battdir;
++    struct dirent *batt;
++    char *name;
++    char *names[MAXBATT];
++    char ps_type[16];
++    int i, j;
++    
++    /* now enumerate batteries */
++    globals->battery_count = 0;
++    battdir = opendir("/sys/class/power_supply");
++    if (battdir == NULL) {
++	pfatal("No batteries or ACPI not supported\n");
++	return 1;
++    }
++    while ((batt = readdir(battdir))) {
++	/* there's a serious problem with this code when there's
++	 * more than one battery: the readdir won't return the
++	 * entries in sorted order, so battery one won't 
++	 * necessarily be the first one returned. So, we need
++	 * to sort them ourselves before adding them to the 
++	 * batteries array. */
++	name = batt->d_name;
++	
++	/* skip ., .. and dotfiles */
++	if (name[0] == '.')
++	    continue;
++
++	if (read_sysfs_file(name, "type", ps_type, sizeof(ps_type)) < 0)
++	  continue;
++
++	if (strncmp("Battery", ps_type, 7) != 0)
++	  continue;
++
++	names[globals->battery_count] = strdup(name);
++	globals->battery_count++;
++    }
++    closedir(battdir);
++
++    /* A nice quick insertion sort, ala CLR. */
++    {
++	char *tmp1, *tmp2;
++	
++	for (i = 1; i < globals->battery_count; i++) {
++	    tmp1 = names[i];
++	    j = i - 1;
++	    while ((j >= 0) && ((strcmp(tmp1, names[j])) < 0)) {
++		tmp2 = names[j+1];
++		names[j+1] = names[j];
++		names[j] = tmp2;
++	    }
++	}
++    }
++    
++    for (i = 0; i < globals->battery_count; i++) {
++	snprintf(batteries[i].name, MAX_NAME, "%s", names[i]);
++	pdebug("battery detected at /sys/class/power_supply/%s\n", batteries[i].name);
++	pinfo("found battery %s\n", names[i]);
++    }
++
++    /* tell user some info */
++    pdebug("%d batteries detected\n", globals->battery_count);
++    pinfo("libacpi: found %d batter%s\n", globals->battery_count,
++	    (globals->battery_count == 1) ? "y" : "ies");
++
++    return 0;
++}
++
++static int procfs_init_batteries(global_t *globals)
+ {
+     DIR *battdir;
+     struct dirent *batt;
+@@ -83,6 +188,14 @@
+     return 0;
+ }
+ 
++int init_batteries(global_t *globals)
++{
++  if (data_source == SYSFS_DATA_SOURCE)
++    return sysfs_init_batteries(globals);
++  else
++    return procfs_init_batteries(globals);
++}
++
+ /* a stub that just calls the current function */
+ int reinit_batteries(global_t *globals)
+ {
+@@ -90,10 +203,59 @@
+     return init_batteries(globals);
+ }
+ 
+-/* the actual name of the subdirectory under ac_adapter may
++/* the actual name of the subdirectory under power_supply may
+  * be anything, so we need to read the directory and use the
+  * name we find there. */
+-int init_ac_adapters(global_t *globals)
++static int sysfs_init_ac_adapters(global_t *globals)
++{
++    DIR *acdir;
++    struct dirent *adapter;
++    adapter_t *ap = &globals->adapter;
++    char *name;
++    char ps_type[16];
++
++    acdir = opendir("/sys/class/power_supply");
++    if (acdir == NULL) {
++	pfatal("Unable to open /sys/class/power_supply -"
++		" are you sure this system supports ACPI?\n");
++	return 1;
++    }
++    name = NULL;
++    while ((adapter = readdir(acdir)) != NULL) {
++	name = adapter->d_name;
++
++	if (name[0] == '.') {
++	  name = NULL;
++	  continue;
++	}
++
++	if (read_sysfs_file(name, "type", ps_type, sizeof(ps_type)) < 0) {
++	  name = NULL;
++	  continue;
++	}
++
++	if (strncmp("Mains", ps_type, 5) == 0) {
++	  pdebug("found adapter %s\n", name);
++	  break;
++	} else {
++	  name = NULL;
++	}
++    }
++    closedir(acdir);
++
++    if (name == NULL) {
++      perr("No AC adapter found !\n");
++      return 1;
++    }
++
++    /* we'll just use the first adapter we find ... */
++    ap->name = strdup(name);
++    pinfo("libacpi: found ac adapter %s\n", ap->name);
++    
++    return 0;
++}
++
++static int procfs_init_ac_adapters(global_t *globals)
+ {
+     DIR *acdir;
+     struct dirent *adapter;
+@@ -125,6 +287,14 @@
+     return 0;
+ }
+ 
++int init_ac_adapters(global_t *globals)
++{
++  if (data_source == SYSFS_DATA_SOURCE)
++    return sysfs_init_ac_adapters(globals);
++  else
++    return procfs_init_ac_adapters(globals);
++}
++
+ /* stub that does nothing but call the normal init function */
+ int reinit_ac_adapters(global_t *globals)
+ {
+@@ -162,6 +332,15 @@
+     /* yep, all good */
+     fclose(acpi);
+ 
++    /* determine data source */
++    if (access("/sys/class/power_supply", R_OK | X_OK) == 0) {
++      data_source = SYSFS_DATA_SOURCE;
++      pinfo("Selecting sysfs as the data source\n");
++    } else {
++      data_source = PROC_DATA_SOURCE;
++      pinfo("Selecting procfs as the data source\n");
++    }
++
+     if (!(retval = init_batteries(globals)))
+ 	retval = init_ac_adapters(globals);
+ 
+@@ -187,7 +366,7 @@
+     return retval;
+ }
+ 
+-char *get_value(char *string)
++static char *get_value(char *string)
+ {
+     char *retval;
+     int i;
+@@ -203,14 +382,29 @@
+     return retval;
+ }
+ 
+-int check_error(char *buf)
++static int check_error(char *buf)
+ {
+     if(strstr(buf, "ERROR") != NULL)
+ 	return 1;
+     return 0;
+ }
+ 
+-power_state_t get_power_status(global_t *globals)
++
++static power_state_t sysfs_get_power_status(global_t *globals)
++{
++    char online[2];
++    adapter_t *ap = &globals->adapter;
++
++    if (read_sysfs_file(ap->name, "online", online, sizeof(online)) < 0)
++      return PS_ERR;
++
++    if (*online == '1')
++	return AC;
++    else
++	return BATT;
++}
++
++static power_state_t procfs_get_power_status(global_t *globals)
+ {
+     FILE *file;
+     char buf[1024];
+@@ -232,7 +426,105 @@
+ 	return BATT;
+ }
+ 
+-int get_battery_info(int batt_no)
++power_state_t get_power_status(global_t *globals)
++{
++  if (data_source == SYSFS_DATA_SOURCE)
++    return sysfs_get_power_status(globals);
++  else
++    return procfs_get_power_status(globals);
++}
++
++static int sysfs_get_battery_info(global_t *globals, int batt_no)
++{
++    battery_t *info = &batteries[batt_no];
++    char buf[32];
++    int ret;
++
++    /* check to see if battery is present */
++    ret = read_sysfs_file(info->name, "present", buf, sizeof(buf));
++    if (ret < 0) {
++      /* interestingly, when the battery is not present, the whole
++       * /sys/class/power_supply/BATn directory does not exist.
++       * Yes, this is broken.
++       */
++      if (ret == -2)
++	info->present = 0;
++
++      /* reinit batteries, this one went away and it's very
++	 possible there just isn't any other one */
++      reinit_batteries(globals);
++
++      return 0;
++    }
++
++    info->present = (*buf == '1');
++    if (!info->present) {
++      pinfo("Battery %s not present\n", info->name);
++      return 0;
++    }
++
++    /* get design capacity
++     * note that all these integer values can also contain the
++     * string 'unknown', so we need to check for this. */
++    if (read_sysfs_file(info->name, "energy_full_design", buf, sizeof(buf)) < 0)
++      info->design_cap = -1;
++    else
++      info->design_cap = strtoul(buf, NULL, 10) / 1000;
++
++    /* get last full capacity */
++    if (read_sysfs_file(info->name, "energy_full", buf, sizeof(buf)) < 0)
++      info->last_full_cap = -1;
++    else
++      info->last_full_cap = strtoul(buf, NULL, 10) / 1000;
++
++    /* get design voltage */
++    if (read_sysfs_file(info->name, "voltage_min_design", buf, sizeof(buf)) < 0)
++      info->design_voltage = -1;
++    else
++      info->design_voltage = strtoul(buf, NULL, 10) / 1000;
++
++    /* get charging state */
++    if (read_sysfs_file(info->name, "status", buf, sizeof(buf)) < 0) {
++      info->charge_state = CH_ERR;
++    } else {
++      if (strncmp(buf, "Unknown", 7) == 0)
++	info->charge_state = CH_ERR;
++      else if (strncmp(buf, "Discharging", 11) == 0)
++	info->charge_state = DISCHARGE;
++      else if (strncmp(buf, "Charging", 8) == 0)
++	info->charge_state = CHARGE;
++      else if (strncmp(buf, "Not charging", 12) == 0)
++	info->charge_state = NO_CHARGE;
++      else if (strncmp(buf, "Full", 4) == 0)
++	info->charge_state = FULL; /* DISCHARGE ? as per old comment ... */
++    }
++
++    /* get current rate of burn 
++     * note that if it's on AC, this will report 0 */
++    if (read_sysfs_file(info->name, "current_now", buf, sizeof(buf)) < 0)
++      info->present_rate = -1;
++    else {
++      int rate;
++      rate = strtoul(buf, NULL, 10) / 1000;
++      info->present_rate = (rate != 0) ? rate : info->present_rate;
++    }
++
++    /* get remaining capacity */
++    if (read_sysfs_file(info->name, "energy_now", buf, sizeof(buf)) < 0)
++      info->remaining_cap = -1;
++    else
++      info->remaining_cap = strtoul(buf, NULL, 10) / 1000;
++
++    /* get current voltage */
++    if (read_sysfs_file(info->name, "voltage_now", buf, sizeof(buf)) < 0)
++      info->present_voltage = -1;
++    else
++      info->present_voltage = strtoul(buf, NULL, 10) / 1000;
++
++    return 1;
++}
++
++static int procfs_get_battery_info(global_t *globals, int batt_no)
+ {
+     FILE *file;
+     battery_t *info = &batteries[batt_no];
+@@ -241,6 +533,8 @@
+     int buflen;
+     char *val;
+ 
++    globals = globals; /* unused here */
++
+     if ((file = fopen(info->info_file, "r")) == NULL) {
+ 	/* this is cheating, but string concatenation should work . . . */
+ 	pfatal("Could not open %s:", info->info_file );
+@@ -325,18 +619,6 @@
+ 	return 0;
+     }
+ 
+-    /* get capacity state 
+-     * note that this has only two values (at least, in the 2.4.21-rc2
+-     * source code) - ok and critical. */
+-    entry = strstr(buf, "capacity state:");
+-    val = get_value(entry);
+-    if (val[0] == 'u')
+-	info->capacity_state = CS_ERR;
+-    else if ((strncmp(val, "ok", 2)) == 0)
+-	info->capacity_state = OK;
+-    else
+-	info->capacity_state = CRITICAL;
+-
+     /* get charging state */
+     entry = strstr(buf, "charging state:");
+     val = get_value(entry);
+@@ -385,6 +667,15 @@
+     return 1;
+ }
+ 
++int get_battery_info(global_t *globals, int batt_no)
++{
++  if (data_source == SYSFS_DATA_SOURCE)
++    return sysfs_get_battery_info(globals, batt_no);
++  else
++    return procfs_get_battery_info(globals, batt_no);
++}
++
++
+ /*
+  * 2003-7-1.
+  * In order to make this code more convenient for things other than
+@@ -562,7 +853,7 @@
+     battery_t *binfo;
+     adapter_t *ap = &globals->adapter;
+     
+-    get_battery_info(batt);
++    get_battery_info(globals, batt);
+     
+     binfo = &batteries[batt];
+     
+@@ -593,16 +884,6 @@
+     /* we need to /know/ that we've got a valid state for the 
+      * globals->power value . . . .*/
+     ap->power = get_power_status(globals);
+-
+-    if ((ap->power != AC) && (binfo->charge_state == DISCHARGE)) {
+-	/* we're not on power, and not charging. So we might as well 
+-	 * check if we're at a critical battery level, and calculate
+-	 * other interesting stuff . . . */
+-	if (binfo->capacity_state == CRITICAL) {
+-	    pinfo("Received critical battery status");
+-	    ap->power = HARD_CRIT;
+-	}
+-    }
+     
+     binfo->charge_time = calc_charge_time(globals, batt);
+ 
+diff -urNad wmacpi-2.2~rc1~/libacpi.h wmacpi-2.2~rc1/libacpi.h
+--- wmacpi-2.2~rc1~/libacpi.h	2007-07-13 17:26:30.000000000 +0200
++++ wmacpi-2.2~rc1/libacpi.h	2008-02-10 18:30:18.959898139 +0100
+@@ -2,7 +2,7 @@
+ #define _LIBACPI_H_
+ 
+ 
+-#define LIBACPI_VER "0.93"
++#define LIBACPI_VER "0.93sysfs"
+ 
+ /* Here because we need it for definitions in this file . . . */
+ #define MAX_NAME 128
+@@ -26,22 +26,17 @@
+     MED,
+     LOW,
+     CRIT,
+-    HARD_CRIT,
+     BS_ERR,
+ } batt_state_t;
+ 
+ typedef enum {
+     CHARGE,
+     DISCHARGE,
++    FULL,
++    NO_CHARGE,
+     CH_ERR,
+ } charge_state_t;
+ 
+-typedef enum {
+-    OK,
+-    CRITICAL,
+-    CS_ERR,
+-} cap_state_t;
+-
+ typedef struct {
+     /* general info */
+     char name[MAX_NAME];
+@@ -53,7 +48,6 @@
+     int last_full_cap;
+     int design_voltage;		/* in mV */
+     /* state info */
+-    cap_state_t capacity_state;
+     charge_state_t charge_state;
+     int present_rate;		/* in mAh */
+     int remaining_cap;		/* in mAh */
+diff -urNad wmacpi-2.2~rc1~/master.xpm wmacpi-2.2~rc1/master.xpm
+--- wmacpi-2.2~rc1~/master.xpm	2007-07-13 17:26:30.000000000 +0200
++++ wmacpi-2.2~rc1/master.xpm	2008-02-10 18:30:18.960898039 +0100
+@@ -96,9 +96,9 @@
+ " .	c #004941",
+ "..	c #20B2AE",
+ "+.	c #303030",
+-"@.	c #027E72",
+-"#.	c #188A86",
+-"$.	c #22B2AE",
++"@.	c #188A86",
++"#.	c #22B2AE",
++"$.	c #027E72",
+ "%.	c #034A40",
+ "&.	c #107D79",
+ "                                                                                                                                .   + @ # $ % & * = - % ; > , ' % ) ! ~ { % ] ^ / ( % _ : < [ % } | 1 2 % 3 4 5 6 % 7 8 9 0 % a b c d % e f g h                                                                           ",
+@@ -119,39 +119,39 @@
+ "        . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . . . . . . . .         .   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %   %  .% % % %  .%  .% % % %  .% % ..% %  .% % % %  .%  .% % % %  .%       ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % `     . % % % % % % % % % % % % % % % % % % % % % % % `         .   +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.  %  .% % % %  .%  .% % % %  .% % ..% %  .% % % %  .%  .% % % %  .%       ",
+ "        . % % % % % % ..........% % % % ....................% % `     . % % % % %  . . .% % %  . . .% % % ..% % % % % `         .                                                                                                                 %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       ",
+-"        . % % % % % ..% % % % ......% % ..% % % % % % % % ..% % `     . % %  .%  .% % %  .%  .% % %  .% ..% ..% ..% % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   % @......... at .% @......... at .% % % % % @......... at .% @......... at .%       ",
+-"        . % % % % % ..% % % % ..% % % % ..% % % % % % % % ....% `     . % %  .%  .% % %  .%  .% % %  .% % ..% ..% % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %       ",
+-"        . % % % ......% % % % ..% % % % ..% % % % % % % % ....% `     . % % % % %  . . .% % %  . . .% % % % ..% % % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % ..% %  .% % % %  .%  .% % % %  .%       ",
+-"        . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% `     . % %  .%  .% % %  .%  .% % %  .% % ..% ..% % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % ..% %  .% % % %  .%  .% % % %  .%       ",
+-"        . % ..% % % % ..........% % % % ..% % % % % % % % ..% % `     . % %  .%  .% % %  .%  .% % %  .% ..% ..% ..% % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       ",
+-"        . % ..% % % % % % % % % % % % % ....................% % `     . % % % % %  . . .% % %  . . .% % % % % ..% % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       ",
++"        . % % % % % ..% % % % ......% % ..% % % % % % % % ..% % `     . % %  .%  .% % %  .%  .% % %  .% ..% ..% ..% % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       ",
++"        . % % % % % ..% % % % ..% % % % ..% % % % % % % % ....% `     . % %  .%  .% % %  .%  .% % %  .% % ..% ..% % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   % % ........% % % ........% % % % % % % ........% % % ........% %       ",
++"        . % % % ......% % % % ..% % % % ..% % % % % % % % ....% `     . % % % % %  . . .% % %  . . .% % % % ..% % % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       ",
++"        . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% `     . % %  .%  .% % %  .%  .% % %  .% % ..% ..% % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       ",
++"        . % ..% % % % ..........% % % % ..% % % % % % % % ..% % `     . % %  .%  .% % %  .%  .% % %  .% ..% ..% ..% % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % ..% %  .% % % %  .%  .% % % %  .%       ",
++"        . % ..% % % % % % % % % % % % % ....................% % `     . % % % % %  . . .% % %  . . .% % % % % ..% % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   %  .% % % %  .%  .% % % %  .% % ..% %  .% % % %  .%  .% % % %  .%       ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % `     . % % % % % % % % % % % % % % % % % % % % % % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % `     . % % % % % % % % % % % % % % % % % % % % % % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   % % % % % % % % % % % % % % % % % % % % % % % % % %   % % % % % %       ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % `     . % % % % % % % % % % % % % % % % % % % % % % % `         .   i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %       ",
+ "        ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `     ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `         .                                                                                                                                                                                         ",
+ "                                                                                                                                .   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %                                           ",
+-"                                                                                                                                .   % % ......% % %  . . .#.% #.......#.% #.......#.% #. . . .#.% #.......#.% #.......#.% #.......#.% #.......#.% #.......#.% % ..% % % % % % %                                           ",
++"                                                                                                                                .   % % ......% % %  . . . at .% @....... at .% @....... at .% @. . . . at .% @....... at .% @....... at .% @....... at .% @....... at .% @....... at .% % ..% % % % % % %                                           ",
+ "        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . `         .   % ..% % % ..%  .% % % ..%  .% % % ..%  .% % % ..% ..% % % ..% ..% % %  .% ..% % %  .%  .% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % ..%                                           ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % ..% % % ..%  .% % % ..%  .% % % ..%  .% % % ..% ..% % % ..% ..% % %  .% ..% % %  .%  .% % % ..% ..% % % ..% ..% % % ..% % ..% ..% % % #.%                                           ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % #. . . .#.% %  . . .#.% #.......#.% % ......#.% #.......#.% #.......#.% #.......#.% %  . . .#.% #.......#.% #.......#.% % % ..% % % % % %                                           ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % ..% % % ..%  .% % % ..%  .% % % ..%  .% % % ..% ..% % % ..% ..% % %  .% ..% % %  .%  .% % % ..% ..% % % ..% ..% % % ..% % ..% ..% % % @.%                                           ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % @. . . . at .% %  . . . at .% @....... at .% % ...... at .% @....... at .% @....... at .% @....... at .% %  . . . at .% @....... at .% @....... at .% % % ..% % % % % %                                           ",
+ "        . % % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% % % `     % % % % % % % % %  . . . .% % % `         .   % ..% % % ..%  .% % % ..% ..% % %  .%  .% % % ..%  .% % % ..%  .% % % ..% ..% % % ..%  .% % % ..% ..% % % ..%  .% % % ..% % ..% ..% % % % %                                           ",
+ "        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % % % % % % % %  .% % % %  .% % `         .   % ..% % % ..%  .% % % ..% ..% % %  .%  .% % % ..%  .% % % ..%  .% % % ..% ..% % % ..%  .% % % ..% ..% % % ..%  .% % % ..% ..% ..% ..% % ..%                                           ",
+-"        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % $.$.$.$.% % %  .% % % %  .% % `         .   % % ......% % %  . . .#.% #.......#.% #.......#.% %  . . .#.% #.......#.% #.......#.% %  . . .#.% #.......#.% #.......#.% % % % ..% % % #.%                                           ",
+-"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % $.% % % $.% %  .% % % %  .% % `         .   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %                                           ",
+-"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % $.% % % $.% %  .% % % %  .% % `         .                                                                                                                                                                                         ",
+-"        . % % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% % % `     % $.% % % $.% % %  . . . .% % % `         .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %   . . . . . . . . . . . . . . . . `                                               ",
+-"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % $.$.$.$.% % %  .% % % %  .% % `         .   % % % % % % ..........% % %   % ....................% %   % #.% % ......% % % ......% % % ..% % % %   % % % % % % % % % % % % % % % % `                                               ",
+-"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % $.% % % $.% %  .% % % %  .% % `         .   % % % % % ..% % % % ......%   % ..% % % % % % % % ..% %   % ..% ..% % % ..% ..% % % ..% ..% ..% ..%   % % % % % % % % % % % % % % % % `                                               ",
+-"        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % $.% % % $.% %  .% % % %  .% % `         .   % % % % % ..% % % % ..% % %   % ..% % % % % % % % ....%   % ..% ..% % % ..% ..% % % ..% % ..% ..% %   % % % % % % % % %  . . . .% % % `                                               ",
+-"        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % $.% % % $.% %  .% % % %  .% % `         .   % % % ......% % % % ..% % %   % ..% % % % % % % % ....%   % #.% #. . . .#.% #. . . .#.% % % ..% % %   % % % % % % % %  .% % % %  .% % `                                               ",
+-"        . % % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% % % `     % $.$.$.$.% % % %  . . . .% % % `         .   % % ..% % ..% % % % ......%   % ..% % % % % % % % ....%   % ..% ..% % % ..% ..% % % ..% % ..% ..% %   % $.$.$.$.% % %  .% % % %  .% % `                                               ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % ..% % % % ..........% % %   % ..% % % % % % % % ..% %   % ..% ..% % % ..% ..% % % ..% ..% ..% ..%   % $.% % % $.% %  .% % % %  .% % `                                               ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % ..% % % % % % % % % % % %   % ....................% %   % #.% % ......% % % ......% % % % % ..% %   % $.% % % $.% %  .% % % %  .% % `                                               ",
+-"        ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `     ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `         .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %   % $.% % % $.% % %  . . . .% % % `                                               ",
+-"                                                                                                                                .                                                                                                         % $.$.$.$.% % %  .% % % %  .% % `                                               ",
+-"                                                                                                                                .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %   % $.% % % $.% %  .% % % %  .% % `                                               ",
+-"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         .   % % % % % %  . . . . .% % %   %  . . . . . . . . . .% %   % % % %  . . .% % %  . . .% % %  .% % % %   % $.% % % $.% %  .% % % %  .% % `                                               ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % % % %  .% % % %  . . .%   %  .% % % % % % % %  .% %   %  .%  .% % %  .%  .% % %  .%  .%  .%  .%   % $.% % % $.% %  .% % % %  .% % `                                               ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % % % %  .% % % %  .% % %   %  .% % % % % % % %  . .%   %  .%  .% % %  .%  .% % %  .% %  .%  .% %   % $.$.$.$.% % % %  . . . .% % % `                                               ",
++"        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % #.#.#.#.% % %  .% % % %  .% % `         .   % % ......% % %  . . . at .% @....... at .% @....... at .% %  . . . at .% @....... at .% @....... at .% %  . . . at .% @....... at .% @....... at .% % % % ..% % % @.%                                           ",
++"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % #.% % % #.% %  .% % % %  .% % `         .   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %                                           ",
++"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % #.% % % #.% %  .% % % %  .% % `         .                                                                                                                                                                                         ",
++"        . % % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% % % `     % #.% % % #.% % %  . . . .% % % `         .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %   . . . . . . . . . . . . . . . . `                                               ",
++"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % #.#.#.#.% % %  .% % % %  .% % `         .   % % % % % % ..........% % %   % ....................% %   % @.% % ......% % % ......% % % ..% % % %   % % % % % % % % % % % % % % % % `                                               ",
++"        . % %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .% % `     % #.% % % #.% %  .% % % %  .% % `         .   % % % % % ..% % % % ......%   % ..% % % % % % % % ..% %   % ..% ..% % % ..% ..% % % ..% ..% ..% ..%   % % % % % % % % % % % % % % % % `                                               ",
++"        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % #.% % % #.% %  .% % % %  .% % `         .   % % % % % ..% % % % ..% % %   % ..% % % % % % % % ....%   % ..% ..% % % ..% ..% % % ..% % ..% ..% %   % % % % % % % % %  . . . .% % % `                                               ",
++"        . % %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .% % `     % #.% % % #.% %  .% % % %  .% % `         .   % % % ......% % % % ..% % %   % ..% % % % % % % % ....%   % @.% @. . . . at .% @. . . . at .% % % ..% % %   % % % % % % % %  .% % % %  .% % `                                               ",
++"        . % % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% % % `     % #.#.#.#.% % % %  . . . .% % % `         .   % % ..% % ..% % % % ......%   % ..% % % % % % % % ....%   % ..% ..% % % ..% ..% % % ..% % ..% ..% %   % #.#.#.#.% % %  .% % % %  .% % `                                               ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % ..% % % % ..........% % %   % ..% % % % % % % % ..% %   % ..% ..% % % ..% ..% % % ..% ..% ..% ..%   % #.% % % #.% %  .% % % %  .% % `                                               ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `     % % % % % % % % % % % % % % % % `         .   % ..% % % % % % % % % % % %   % ....................% %   % @.% % ......% % % ......% % % % % ..% %   % #.% % % #.% %  .% % % %  .% % `                                               ",
++"        ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `     ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `         .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %   % #.% % % #.% % %  . . . .% % % `                                               ",
++"                                                                                                                                .                                                                                                         % #.#.#.#.% % %  .% % % %  .% % `                                               ",
++"                                                                                                                                .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %   % #.% % % #.% %  .% % % %  .% % `                                               ",
++"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         .   % % % % % %  . . . . .% % %   %  . . . . . . . . . .% %   % % % %  . . .% % %  . . .% % %  .% % % %   % #.% % % #.% %  .% % % %  .% % `                                               ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % % % %  .% % % %  . . .%   %  .% % % % % % % %  .% %   %  .%  .% % %  .%  .% % %  .%  .%  .%  .%   % #.% % % #.% %  .% % % %  .% % `                                               ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % % % %  .% % % %  .% % %   %  .% % % % % % % %  . .%   %  .%  .% % %  .%  .% % %  .% %  .%  .% %   % #.#.#.#.% % % %  . . . .% % % `                                               ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % %  . . .% % % %  .% % %   %  .% % % % % % % %  . .%   % % % %  . . .% % %  . . .% % % %  .% % %   % % % % % % % % % % % % % % % % `                                               ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % %  .% %  .% % % %  . . .%   %  .% % % % % % % %  . .%   %  .%  .% % %  .%  .% % %  .% %  .%  .% %   % % % % % % % % % % % % % % % % `                                               ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   %  .% % % %  . . . . .% % %   %  .% % % % % % % %  .% %   %  .%  .% % %  .%  .% % %  .%  .%  .%  .%   ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `                                               ",
+@@ -159,33 +159,33 @@
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % % % % % % % % % % % % %   % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % %                                                                                   ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .                                                                                                                                                                                         ",
+ "        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %   % % % % % %                       ",
+-"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % $.$.$.% % % % % % @.% @.$.$.$. at .% @.$.$.$. at .% @.% % % @.% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% % % % % % % % % % % % %   % % % % % %                       ",
+-"        ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `         .   % $.% % % $.% % % % % $.% % % % % $.% % % % % $.% $.% % % $.% $.% % % % % $.% % % % % % % % % $.% $.% % % $.% $.% % % $.% % % % % % % % % % % % %   % % % % % %                       ",
+-"                                                                                                                                .   % $.% % % $.% % % % % $.% % % % % $.% % % % % $.% $.% % % $.% $.% % % % % $.% % % % % % % % % $.% $.% % % $.% $.% % % $.% % % % % % % % % % % % %   % % % % % %                       ",
+-"                                                                                                                                .   % @.% % % @.% % % % % @.% @.$.$.$. at .% % $.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% % % % % @.% %.$.$.$.%.% @.$.$.$. at .% @.$.$.$. at .% % % % % % %   % % % % % %                       ",
+-"                                                                                                                                .   % $.% % % $.% % % % % $.% $.% % % % % % % % % $.% % % % % $.% % % % % $.% $.% % % $.% % % % % $.% $.% % % $.% % % % % $.% % % % % % % % % % % % %   % % % % % %                       ",
+-"                                                                                                                                .   % $.% % % $.% % % % % $.% $.% % % % % % % % % $.% % % % % $.% % % % % $.% $.% % % $.% % % % % $.% $.% % % $.% % % % % $.% % % % % % % % % % % % %   % % % % % %                       ",
+-". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   % % $.$.$.% % % % % % $.% @.$.$.$. at .% @.$.$.$. at .% % % % % @.% @.$.$.$. at .% @.$.$.$. at .% % % % % @.% @.$.$.$. at .% @.$.$.$. at .% % % % % % % % % % % % %   % % % % $.%                       ",
++"        . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % `         .   % % #.#.#.% % % % % % $.% $.#.#.#.$.% $.#.#.#.$.% $.% % % $.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% % % % % % % % % % % % %   % % % % % %                       ",
++"        ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `         .   % #.% % % #.% % % % % #.% % % % % #.% % % % % #.% #.% % % #.% #.% % % % % #.% % % % % % % % % #.% #.% % % #.% #.% % % #.% % % % % % % % % % % % %   % % % % % %                       ",
++"                                                                                                                                .   % #.% % % #.% % % % % #.% % % % % #.% % % % % #.% #.% % % #.% #.% % % % % #.% % % % % % % % % #.% #.% % % #.% #.% % % #.% % % % % % % % % % % % %   % % % % % %                       ",
++"                                                                                                                                .   % $.% % % $.% % % % % $.% $.#.#.#.$.% % #.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% % % % % $.% %.#.#.#.%.% $.#.#.#.$.% $.#.#.#.$.% % % % % % %   % % % % % %                       ",
++"                                                                                                                                .   % #.% % % #.% % % % % #.% #.% % % % % % % % % #.% % % % % #.% % % % % #.% #.% % % #.% % % % % #.% #.% % % #.% % % % % #.% % % % % % % % % % % % %   % % % % % %                       ",
++"                                                                                                                                .   % #.% % % #.% % % % % #.% #.% % % % % % % % % #.% % % % % #.% % % % % #.% #.% % % #.% % % % % #.% #.% % % #.% % % % % #.% % % % % % % % % % % % %   % % % % % %                       ",
++". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   % % #.#.#.% % % % % % #.% $.#.#.#.$.% $.#.#.#.$.% % % % % $.% $.#.#.#.$.% $.#.#.#.$.% % % % % $.% $.#.#.#.$.% $.#.#.#.$.% % % % % % % % % % % % %   % % % % #.%                       ",
+ "                                                                                                                                    % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %                                     ",
+ "% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
+-"% %.$.$.$.%.% @.$.$.$.% % @.$.$.$. at .% @.$.$.$.% % @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.% % % @.% % % @.% % % % % % % @.% @.% % % @.% @.% % % % % $.% % % $.% @.$.$.$.% % @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.$.$.$. at .% @.% % % @.% @.% % % @.% @.% % % @.% @.% % % @.% @.% % % @.% @.$.$.$. at .% ",
+-"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % % % $.% % % $.% % % $.% % % % % % % $.% $.% % % $.% $.% % % % % $.$.% $.$.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % % % $.% % % $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% % % % % $.% ",
+-"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % % % $.% % % $.% % % $.% % % % % % % $.% $.% % $.%.% $.% % % % % $.% $.% $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % % % $.% % % $.% % % $.% $.% % % $.% $.% % % $.% %.$.% $.%.% $.% % % $.% % % % $.%.% ",
+-"% @.$.$.$. at .% @.$.$.$.% % @.% % % % % @.% % % @.% @.$.$.$.% % @.$.$.$.% % @.%.$.$. at .% @.$.$.$. at .% % % @.% % % % % % % @.% @.$.$.%.% % @.% % % % % @.% % % @.% @.% % % @.% @.% % % @.% @.$.$.$. at .% @.$.% % @.% @.$.$.$.% % @.$.$.$. at .% % % @.% % % @.% % % @.% @.% % % @.% @.% % % @.% % %.$.%.% % @.$.$.$. at .% % %.$.%.% % ",
+-"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % $.% $.% % % $.% % % $.% % % % % % % $.% $.% % $.%.% $.% % % % % $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % $.% $.% $.% $.% % % $.% % % % % $.% % % $.% % % $.% % % $.% $.% % % $.% $.% $.% $.% %.$.% $.%.% % % % % $.% %.$.% % % % ",
+-"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % $.% $.% % % $.% % % $.% % % % % % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % $.% % $.$.% $.% % % $.% % % % % $.% % % $.% % % $.% % % $.% $.% % % $.% $.$.% $.$.% $.% % % $.% % % % % $.% $.% % % % % ",
+-"% @.% % % @.% @.$.$.$.% % @.$.$.$. at .% $.$.$.$.% % @.$.$.$. at .% $.% % % % % @.$.$.$. at .% @.% % % @.% % % $.% % % @.$.$.$. at .% @.% % % @.% @.$.$.$.%.% @.% % % @.% $.% % % $.% @.$.$.$. at .% @.% % % % % @.$.$.$. at .% @.% % % @.% @.$.$.$. at .% % % @.% % % %.$.$.$.$.% % $.$.$.% % $.% % % $.% @.% % % $.% @.$.$.$. at .% @.$.$.$. at .% ",
++"% %.#.#.#.%.% $.#.#.#.% % $.#.#.#.$.% $.#.#.#.% % $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.% % % $.% % % $.% % % % % % % $.% $.% % % $.% $.% % % % % #.% % % #.% $.#.#.#.% % $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.#.#.#.$.% ",
++"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % % % #.% % % #.% % % #.% % % % % % % #.% #.% % % #.% #.% % % % % #.#.% #.#.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % % % #.% % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% % % % % #.% ",
++"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % % % #.% % % #.% % % #.% % % % % % % #.% #.% % #.%.% #.% % % % % #.% #.% #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % % % #.% % % #.% % % #.% #.% % % #.% #.% % % #.% %.#.% #.%.% #.% % % #.% % % % #.%.% ",
++"% $.#.#.#.$.% $.#.#.#.% % $.% % % % % $.% % % $.% $.#.#.#.% % $.#.#.#.% % $.%.#.#.$.% $.#.#.#.$.% % % $.% % % % % % % $.% $.#.#.%.% % $.% % % % % $.% % % $.% $.% % % $.% $.% % % $.% $.#.#.#.$.% $.#.% % $.% $.#.#.#.% % $.#.#.#.$.% % % $.% % % $.% % % $.% $.% % % $.% $.% % % $.% % %.#.%.% % $.#.#.#.$.% % %.#.%.% % ",
++"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % #.% #.% % % #.% % % #.% % % % % % % #.% #.% % #.%.% #.% % % % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % #.% #.% #.% #.% % % #.% % % % % #.% % % #.% % % #.% % % #.% #.% % % #.% #.% #.% #.% %.#.% #.%.% % % % % #.% %.#.% % % % ",
++"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % #.% #.% % % #.% % % #.% % % % % % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % #.% % #.#.% #.% % % #.% % % % % #.% % % #.% % % #.% % % #.% #.% % % #.% #.#.% #.#.% #.% % % #.% % % % % #.% #.% % % % % ",
++"% $.% % % $.% $.#.#.#.% % $.#.#.#.$.% #.#.#.#.% % $.#.#.#.$.% #.% % % % % $.#.#.#.$.% $.% % % $.% % % #.% % % $.#.#.#.$.% $.% % % $.% $.#.#.#.%.% $.% % % $.% #.% % % #.% $.#.#.#.$.% $.% % % % % $.#.#.#.$.% $.% % % $.% $.#.#.#.$.% % % $.% % % %.#.#.#.#.% % #.#.#.% % #.% % % #.% $.% % % #.% $.#.#.#.$.% $.#.#.#.$.% ",
+ "% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
+ "% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %       % % % % % % % % ",
+-"% % ........% % %  . . . .&.% &.........#.% &.........&.% &. . . . .&.% &.........&.% &.........#.% &.........&.% &.........#.% &.........#.% % % % %         % % ........% % % ........% % % % % % % ........% % % ........% %   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       % % $. . . .$.% ",
+-"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       % $.% $.% $. .% ",
+-"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       %  .$.% $.%  .% ",
+-"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       %  .% $.% $. .% ",
+-"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       %  .$.% $.% $.% ",
+-"% &. . . . .&.% %  . . . .&.% &.........&.% &.........&.% &.........&.% &.........&.% &.........&.% %  . . . .&.% &.........&.% &.........&.% % % % %         % &. . . . .&.% &. . . . .&.% % % % % &. . . . .&.% &. . . . .&.%   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       % $. . . .$.% % ",
++"% % ........% % %  . . . .&.% &......... at .% &.........&.% &. . . . .&.% &.........&.% &......... at .% &.........&.% &......... at .% &......... at .% % % % %         % % ........% % % ........% % % % % % % ........% % % ........% %   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       % % #. . . .#.% ",
++"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       % #.% #.% #. .% ",
++"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       %  .#.% #.%  .% ",
++"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       %  .% #.% #. .% ",
++"% ..% % % % ..%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..% ..% % % %  .% ..% % % %  .%  .% % % % ..% ..% % % % ..% ..% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       %  .#.% #.% #.% ",
++"% &. . . . .&.% %  . . . .&.% &.........&.% &.........&.% &.........&.% &.........&.% &.........&.% %  . . . .&.% &.........&.% &.........&.% % % % %         % &. . . . .&.% &. . . . .&.% % % % % &. . . . .&.% &. . . . .&.%   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       % #. . . .#.% % ",
+ "% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       %  .% % % %  .% ",
+-"% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       % $.$.$.$.$. .% ",
+-"% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       % $.% % % $.$.% ",
+-"% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       % $.% % % $.$.% ",
+-"% % ........% % %  . . . .&.% &.........&.% &.........&.% %  . . . .&.% &.........&.% &.........&.% %  . . . .&.% &.........&.% &.........&.% % % % %         % % ........% % % ........% % % % % % % ........% % % ........% %   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       % $.$.$.$.$.% % ",
++"% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % % % %         % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% % % % %  .% % % %  .%  .% % % %  .%       % #.#.#.#.#. .% ",
++"% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       % #.% % % #.#.% ",
++"% ..% % % % ..%  .% % % % ..% ..% % % %  .%  .% % % % ..%  .% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% ..% % % % ..%  .% % % % ..% % ..% %         % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..%   %  .% % % %  .%  .% % % %  .% %  .% %  .% % % %  .%  .% % % %  .%       % #.% % % #.#.% ",
++"% % ........% % %  . . . .&.% &.........&.% &.........&.% %  . . . .&.% &.........&.% &.........&.% %  . . . .&.% &.........&.% &.........&.% % % % %         % % ........% % % ........% % % % % % % ........% % % ........% %   % %  . . . .% % %  . . . .% % % % % % %  . . . .% % %  . . . .% %       % #.#.#.#.#.% % ",
+ "% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %   % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %       % % % % % % % % "};
+diff -urNad wmacpi-2.2~rc1~/wmacpi.c wmacpi-2.2~rc1/wmacpi.c
+--- wmacpi-2.2~rc1~/wmacpi.c	2007-07-13 17:26:30.000000000 +0200
++++ wmacpi-2.2~rc1/wmacpi.c	2008-02-10 18:30:18.960898039 +0100
+@@ -36,7 +36,7 @@
+ #include "libacpi.h"
+ #include "wmacpi.h"
+ 
+-#define WMACPI_VER "2.2rc1"
++#define WMACPI_VER "2.2rc1+"
+ 
+ /* main pixmap */
+ #ifdef LOW_COLOR
+@@ -61,6 +61,7 @@
+     int bell;			/* bell on critical low, or not? */
+     int scroll;			/* scroll message text? */
+     int scroll_reset;		/* reset the scrolling text */
++    int percent;
+ };
+ 
+ /* globals */
+@@ -113,7 +114,7 @@
+ /* set time display to -- -- */
+ static void invalid_time_display(void)
+ {
+-    copy_xpm_area(122, 13, 31, 11, 7, 32);
++    copy_xpm_area(122, 14, 31, 11, 7, 32);
+ }
+ 
+ static void reset_scroll(void) {
+@@ -195,7 +196,7 @@
+     static int start, end, stop;
+     int x = 6;			/* x coord of the start of the text area */
+     int y = 50;			/* y coord */
+-    int width = 52;		/* width of the text area */
++    int width = 51;		/* width of the text area */
+     int height = 7;		/* height of the text area */
+     int tw = dockapp->tw;	/* width of the rendered text */
+     int sx, dx, w;
+@@ -298,19 +299,27 @@
+     scroll_text();
+ }
+ 
++static void clear_percentage(void)
++{
++  /* clear the number */
++  copy_xpm_area(95, 47, 21, 9, 37, 16);
++  /* clear the bar */
++  copy_xpm_area(66, 18, 54, 8, 5, 5);
++
++  dockapp->percent = -1;
++}
++
+ static void display_percentage(int percent)
+ {
+-    static int op = -1;
+-    static unsigned int obar;
+     unsigned int bar;
+     int width = 54;		/* width of the bar */
+     float ratio = 100.0/width;	/* ratio between the current percentage
+ 				 * and the number of pixels in the bar */
+ 
+     if (percent == -1)
+-	percent = 0;
++        percent = 0;
+ 
+-    if (op == percent)
++    if (dockapp->percent == percent)
+ 	return;
+ 
+     if (percent < 0)
+@@ -318,6 +327,9 @@
+     if (percent > 100)
+ 	percent = 100;
+ 
++    if (dockapp->percent == -1)
++      copy_xpm_area(127, 28, 5, 7, 52, 17);
++
+     if (percent < 100) {	/* 0 - 99 */
+ 	copy_xpm_area(95, 48, 8, 7, 37, 17);
+ 	if (percent >= 10)
+@@ -325,17 +337,13 @@
+ 	copy_xpm_area((percent % 10) * 6 + 67, 28, 5, 7, 46, 17);
+     } else
+ 	copy_xpm_area(95, 37, 21, 9, 37, 16);	/* 100% */
+-    op = percent;
++    dockapp->percent = percent;
+ 
+     bar = (int)((float)percent / ratio);
+ 
+-    if (bar == obar)
+-	return;
+-
+     copy_xpm_area(66, 0, bar, 8, 5, 5);
+     if (bar < 54)
+ 	copy_xpm_area(66 + bar, 18, 54 - bar, 8, bar + 5, 5);
+-    obar = bar;
+ }
+ 
+ static void display_time(int minutes)
+@@ -446,19 +454,12 @@
+ 	}
+     }
+ 
+-    if (binfo->charge_state == CHARGE)
++    if (globals->battery_count > 0) {
++      if (binfo->charge_state == CHARGE)
+ 	blink_power_glyph();
+ 
+-    if ((binfo->state == CRIT) && (ap->power == BATT))
++      if ((binfo->state == CRIT) && (ap->power == BATT))
+ 	blink_battery_glyph();
+-
+-    if (binfo->state == HARD_CRIT) {
+-	really_blink_battery_glyph();
+-	/* we only do this here because it'd be obnoxious to 
+-	 * do it anywhere else. */
+-	if (dockapp->bell) {
+-	    XBell(dockapp->display, 100);
+-	}
+     }
+ }
+ 
+@@ -489,6 +490,7 @@
+  * appropriate right now, and then decide within them. 
+  */
+ enum messages {
++    M_NB,	/* no batteries */
+     M_NP,	/* not present */
+     M_AC,	/* on ac power */
+     M_CH,	/* battery charging */
+@@ -504,6 +506,16 @@
+     static enum messages state = M_NULL;
+     battery_t *binfo = globals->binfo;
+     adapter_t *ap = &globals->adapter;
++
++    if (globals->battery_count == 0) {
++      if (state != M_NB) {
++	state = M_NB;
++	reset_scroll_speed();
++	render_text("no batteries");
++      }
++
++      return;
++    }
+     
+     /* battery not present case */
+     if (!binfo->present) {
+@@ -533,12 +545,6 @@
+ 		scroll_faster(0.75);
+ 		render_text("critical low battery");
+ 	    }
+-	} else if (binfo->state == HARD_CRIT) {
+-	    if (state != M_HCB) {
+-		state = M_HCB;
+-		scroll_faster(0.5);
+-		render_text("hard critical low battery");
+-	    }
+ 	} else if (binfo->state == LOW) {
+ 	    if (state != M_LB) {
+ 		state = M_LB;
+@@ -557,6 +563,11 @@
+ 
+ void set_time_display(global_t *globals)
+ {
++    if (globals->battery_count == 0) {
++        invalid_time_display();
++	return;
++    }
++
+     if (globals->binfo->charge_state == CHARGE)
+ 	display_time(globals->binfo->charge_time);
+     else if (globals->binfo->charge_state == DISCHARGE)
+@@ -565,15 +576,20 @@
+ 	invalid_time_display();
+ }
+ 
++void clear_batt_id_area(void)
++{
++  copy_xpm_area(125, 40, 7, 11, 51, 32);
++}
++
+ void set_batt_id_area(int bno)
+ {
+     int w = 7;			/* Width of the number */
+     int h = 11;			/* Height of the number */
+     int dx = 50;		/* x coord of the target area */
+-    int dy = 31;		/* y coord of the target area */
++    int dy = 32;		/* y coord of the target area */
+     int sx = (bno + 1) * 7;	/* source x coord */
+     int sy = 76;		/* source y coord */
+-    
++
+     copy_xpm_area(sx, sy, w, h, dx, dy);
+ }
+ 
+@@ -628,6 +644,16 @@
+     return;
+ }
+ 
++battery_t *switch_battery(global_t *globals, int battno)
++{
++  globals->binfo = &batteries[battno];
++  pinfo("changing to monitor battery %s\n", globals->binfo->name);
++  set_batt_id_area(battno);
++  dockapp->update = 1;
++
++  return globals->binfo;
++}
++
+ int main(int argc, char **argv)
+ {
+     char *display = NULL;
+@@ -642,7 +668,7 @@
+     int scroll_count = 0;
+     enum rtime_mode rt_mode = RT_RATE;
+     int rt_forced = 0;
+-    battery_t *binfo;
++    battery_t *binfo = NULL;
+     global_t *globals;
+ 
+     DAProgramOption options[] = {
+@@ -717,8 +743,7 @@
+     globals->rt_forced = rt_forced;
+ 
+     if (battery_no > globals->battery_count) {
+-	pfatal("Battery %d not available for monitoring.\n", battery_no);
+-	exit(1);
++	pinfo("Battery %d not available for monitoring.\n", battery_no);
+     }
+ 
+     /* check for cli mode */
+@@ -744,13 +769,17 @@
+ 
+     /* get initial statistics */
+     acquire_all_info(globals);
+-    binfo = &batteries[battery_no];
+-    globals->binfo = binfo;
+-    pinfo("monitoring battery %s\n", binfo->name);
++
++    if (globals->battery_count > 0) {
++      binfo = &batteries[battery_no];
++      globals->binfo = binfo;
++      set_batt_id_area(battery_no);
++      pinfo("monitoring battery %s\n", binfo->name);
++    }
++
+     clear_time_display();
+     set_power_panel(globals);
+     set_message(globals);
+-    set_batt_id_area(battery_no);
+ 
+     /* main loop */
+     while (1) {
+@@ -773,14 +802,14 @@
+ 	    case ButtonPress:
+ 		break;
+ 	    case ButtonRelease:
++	        if (globals->battery_count == 0)
++		  break;
++
+ 		/* cycle through the known batteries. */
+ 		battery_no++;
+ 		battery_no = battery_no % globals->battery_count;
+-		globals->binfo = &batteries[battery_no];
+-		binfo = globals->binfo;
+-		pinfo("changing to monitor battery %s\n", binfo->name);
+-		set_batt_id_area(battery_no);
+-		dockapp->update = 1;
++
++		binfo = switch_battery(globals, battery_no);
+ 		break;
+ 	    case ClientMessage:
+ 		/* what /is/ this crap?
+@@ -834,14 +863,28 @@
+ 	 * translates to 600 sleeps. So, we change the default sample
+ 	 * rate to 20, and the calculation below becomes . . .*/
+ 	if (sample_count++ == ((sleep_rate*60)/samplerate)) {
++	    if (globals->battery_count == 0) {
++	        batt_count = 0;
++
++	        reinit_batteries(globals);
++
++		/* battery appeared */
++		if (globals->battery_count > 0) {
++		    if (battery_no > globals->battery_count)
++		        battery_no = 0;
++			
++		    binfo = switch_battery(globals, battery_no);
++		}
++	    }
++
+ 	    acquire_all_info(globals);
+ 
+ 	    /* we need to be able to reinitialise batteries and adapters, because
+ 	     * they change - you can hotplug batteries on most laptops these days
+ 	     * and who knows what kind of shit will be happening soon . . . */
+ 	    if (batt_count++ >= batt_reinit) {
+-		    if(reinit_batteries(globals)) 
+-			    pfatal("Oh my god, the batteries are gone!\n");
++	        if(reinit_batteries(globals)) 
++		    pfatal("Oh my god, the batteries are gone!\n");
+ 		    batt_count = 0;
+ 	    }
+ 
+@@ -872,7 +915,13 @@
+ 	set_time_display(globals);
+ 	set_power_panel(globals);
+ 	set_message(globals);
+-	display_percentage(binfo->percentage);
++
++	if (globals->battery_count == 0) {
++	  clear_percentage();
++	  clear_batt_id_area();
++	} else 
++	  display_percentage(binfo->percentage);
++
+ 	scroll_text();
+ 
+ 	/* redraw_window, if anything changed - determined inside 

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



More information about the Pkg-wmaker-commits mailing list