[Pkg-wmaker-commits] [wmacpi] 04/105: wmacpi: Bump to wmacpi-ng version 0.50.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 18 01:13:39 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 7a37009cdb3ce84f8cafd3cf55248e9610d64fcc
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Mon Aug 18 17:56:10 2014 -0500
wmacpi: Bump to wmacpi-ng version 0.50.
Source obtained from http://sourceforge.net/projects/wmacpi/files/.
2003 July 6 0.50
Finally got rid of that annoying button - that space now contains
a 'B 1' or 'B 2' (only those two at present, since I'm too lazy to
fix it so that the number is generic. It should work fine for
anyone who doesn't have a freakish system with more than two
batteries . . .)
A few more code cleanups.
---
.xvpics/master-new.xpm | Bin 0 -> 3588 bytes
.xvpics/master.xpm | Bin 0 -> 3588 bytes
.xvpics/master_low.xpm | Bin 0 -> 3588 bytes
COPYING | 341 +-----------------------------------
ChangeLog | 71 ++++++++
Makefile | 44 +++--
TODO | 38 ++++
acpi-ng.c | 125 ++++++++++++++
debian/changelog | 105 +++++++++++
debian/compat | 1 +
debian/control | 21 +++
debian/copyright | 27 +++
debian/dirs | 1 +
debian/docs | 3 +
debian/menu | 2 +
debian/rules | 90 ++++++++++
debian/watch | 2 +
debian/wmacpi-ng.1 | 125 ++++++++++++++
libacpi.c | 451 ++++++++++++++++++++++++++++++++++++------------
libacpi.h | 118 +++++++++++++
libapm.c | 91 ----------
master.xpm | 120 ++++++-------
master_low.xpm | 112 ++++++------
wmacpi.c => wmacpi-ng.c | 412 +++++++++++++++++++++++++------------------
wmacpi-ng.h | 9 +
wmacpi.h | 52 ------
26 files changed, 1457 insertions(+), 904 deletions(-)
diff --git a/.xvpics/master-new.xpm b/.xvpics/master-new.xpm
new file mode 100644
index 0000000..e1c06f0
Binary files /dev/null and b/.xvpics/master-new.xpm differ
diff --git a/.xvpics/master.xpm b/.xvpics/master.xpm
new file mode 100644
index 0000000..4b09bc3
Binary files /dev/null and b/.xvpics/master.xpm differ
diff --git a/.xvpics/master_low.xpm b/.xvpics/master_low.xpm
new file mode 100644
index 0000000..913957f
Binary files /dev/null and b/.xvpics/master_low.xpm differ
diff --git a/COPYING b/COPYING
index d159169..f4f3ea5 100644
--- a/COPYING
+++ b/COPYING
@@ -1,339 +1,2 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
+#include <GNU_GPL_v2>
+ [...]
diff --git a/ChangeLog b/ChangeLog
index b457789..69b6af9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,74 @@
+2003 July 6 0.50
+ Finally got rid of that annoying button - that space now contains
+ a 'B 1' or 'B 2' (only those two at present, since I'm too lazy to
+ fix it so that the number is generic. It should work fine for
+ anyone who doesn't have a freakish system with more than two
+ batteries . . .)
+
+ A few more code cleanups.
+
+2003 July 1 0.19
+ libacpi cleanups and reworking - we now handle the charging
+ battery case properly, it seems.
+
+ Also, some attempts to make error printing a bit cleaner; still a
+ long way to go on that, though . . .
+
+2003 June 24 0.15
+ Removed process_plugin_timer(), since it was doing nothing useful
+ at all . . .
+
+2003 June 23 0.14
+ Removed libapm.c - wmacpi-ng is specifically for ACPI, with no APM
+ support.
+
+2003 June 23 0.13
+ Some more code cleanups, designed to move libacpi to more of a
+ library than something built into wmacpi-ng. This is useful with
+ the seperate programs, though at present it's not used much.
+
+2003 June 21 0.12
+ Added a command line tool, acpi-ng to query battery status from
+ the command line.
+
+2003 May 30 0.11
+ Implemented multiple battery support, and averaging of the samples
+ in an attempt to even out the jumpiness of the timer.
+
+2003 May 30 0.10
+ More major code cleanups: in particular the handling of the power
+ panel and the message has been cleaned up so that it's actually
+ sane and clean.
+
+ Next step from here is to actually implement handling of multiple
+ batteries, so that if there's a fully charge second battery
+ available it reports the correct time remaining (based on the
+ present rate of power consumption and the sum of the two battery's
+ remaining capacities).
+
+2003 May 29 0.3
+ Some major reworking of the internals, to help fix the handling of
+ multiple batteries and such things.
+
+2003 May 26 0.2a
+ Code cleanups to fix various problems with corner cases.
+
+2003 May 26 0.2
+ Added support for multiple batteries: I took the simple route of
+ displaying only one battery per instance - to do more I'd need to
+ hack with the display code, and I'm not ready for that yet.
+
+ Added a -m option to specify the battery number to monitor.
+
+2003 May 26 0.1
+ Changed package completely, to support the new ACPI code as of
+ 2.4.21-rc2.
+
+ Since this code hasn't been touched in more than a year, I figure
+ I might as well have a go at hacking on it . . .
+
+ -- Simon Fowler, <simon at dreamcraft.com.au>
+
2002 Feb 17 1.34
Updated ACPI statistics gathering code for the latest ACPI patch from
Intel. Now uses/checks for subsystem version 20020214+. Redone the version
diff --git a/Makefile b/Makefile
index 79f379c..229ef5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,7 @@
# set options. pick one, acpi or apm. comment out the other one. don't
# uncomment both, bad things will happen :)
-OPT = -O3 -DACPI
-#OPT = -O3 -DAPM
+OPT := -O2
# uncomment this to make wmacpi use less system colors (looks uglier too)
#OPT += -DLOW_COLOR
@@ -10,16 +9,41 @@ OPT = -O3 -DACPI
# debugging options (don't bother with these)
#OPT = -pg -g -DPRO -DACPI
-CC = gcc
-CFLAGS = $(OPT) -Wall -ansi -I/usr/X11R6/include
-LDFLAGS = $(OPT) -L/usr/X11R6/lib -lX11 -lXpm -lXext
+CC := gcc
+CFLAGS := $(OPT) -Wall -W -g -ansi -I/usr/X11R6/include
+LDFLAGS := $(OPT) -L/usr/X11R6/lib -lX11 -lXpm -lXext
-SRCS = wmacpi.c libapm.c libacpi.c
-OBJS = wmacpi.o libapm.o libacpi.o
+WMSRC := wmacpi-ng.c libacpi.c
+CLSRC := acpi-ng.c libacpi.c
+HEADERS := libacpi.h wmacpi-ng.h
+targets := wmacpi-ng acpi-ng
-all: wmacpi
+all: $(targets)
-wmacpi: $(OBJS)
+# build the list of object files
+WMOBJ := $(patsubst %.c,%.o,$(filter %.c,$(WMSRC)))
+CLOBJ := $(patsubst %.c,%.o,$(filter %.c,$(CLSRC)))
+
+# include per-file dependencies
+include $(WMOBJ:.o=.d)
+include $(CLOBJ:.o=.d)
+
+wmacpi-ng: $(WMOBJ)
+ gcc $(LDFLAGS) -o $@ $^
+
+acpi-ng: $(CLOBJ)
+ gcc $(LDFLAGS) -o $@ $^
+
+# build per-file dependencies - note that -MM may not be supported
+# in gcc versions older than 2.95.4, but most likely is.
+%.d: %.c
+ gcc -MM $(CFLAGS) $< > $@
clean:
- rm -f *.o *~ wmacpi trace *.out *.bb *.bbg
+ rm -f TAGS *.o *~ trace *.out *.bb *.bbg
+
+clean-all: clean
+ rm -f *.d $(targets)
+
+tags:
+ etags $(WMSRC) $(CLSRC) $(HEADERS)
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..1aab3e8
--- /dev/null
+++ b/TODO
@@ -0,0 +1,38 @@
+2003 July 6 0.50
+ * Fix the non-deb installation - as it stands, it doesn't even try.
+
+ * Yet more cleanups.
+
+2003 June 24 0.14
+
+ * Still more code cleanups - there's a considerable amount of dumb
+ stuff in there still . . .
+
+ * Display time left for battery charging. But first make sure that
+ this will actually work with other systems.
+
+ * Turn libacpi into a real library?
+
+2003 May 30 0.10
+
+ * More code cleanups, particularly in the various display functions.
+
+ * Full handling of multiple batteries.
+
+ * Add some kind of progressive display of power consumption, roughly
+ similar to what wmmon displays for cpu usage (possibly as a
+ completely seperate display mode, or possibly as a replacement for
+ the (completely useless) button).
+
+ * Drop APM support (maybe?).
+
+2003 May 26 0.2a
+
+ * Restructure power state handling - split it into a boolean AC
+ on/off and a battery status flag.
+
+ * Expand the APMInfo struct to be more useful.
+
+ * Code cleanups . . .
+
+ -- Simon Fowler, <simon at dreamcraft.com.au>
diff --git a/acpi-ng.c b/acpi-ng.c
new file mode 100644
index 0000000..b2919e2
--- /dev/null
+++ b/acpi-ng.c
@@ -0,0 +1,125 @@
+/*
+ * acpi-ng: command line acpi battery status tool.
+ *
+ * Written by Simon Fowler <simon at dreamcraft.com.au>, 2003-06-20.
+ * Copyright 2003-06-20 Dreamcraft Pty Ltd.
+ *
+ * This file is distributed under the GNU General Public License,
+ * version 2. Please see the COPYING file for details.
+ */
+
+/*
+ * 2003-06-20.
+ * I'm getting sick of not having a convenient way to query battery
+ * status on the command line, so I'm hacking up this - a quick little
+ * command line tool to display current battery status, using the same
+ * libacpi code as wmacpi-ng.
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <unistd.h>
+
+#include "libacpi.h"
+
+#define ACPI_NG_VER "0.50"
+
+APMInfo *apminfo;
+
+void usage(char *name)
+{
+ printf("%s: query battery status on ACPI enabled systems.\n"
+ "Usage:\n"
+ "%s [-h] [-a]\n"
+ " h - display this help information\n"
+ " a - average remaining time over some number of samples\n"
+ " much more accurate than using a single sample\n"
+ " v - increase verbosity\n",
+ name, name);
+}
+
+void print_version(void)
+{
+ printf("acpi-ng version %s\n", ACPI_NG_VER);
+ printf(" Using libacpi version %s\n", LIBACPI_VER);
+}
+
+int main(int argc, char *argv[])
+{
+ int i, j, ch;
+ int sleep_time = 0;
+ int samples = 1;
+ battery *binfo;
+
+ while((ch = getopt(argc, argv, "hvVa::")) != EOF) {
+ switch(ch) {
+ case 'h':
+ usage(argv[0]);
+ return 0;
+ case 'v':
+ verbosity++;
+ break;
+ case 'V':
+ print_version();
+ return 0;
+ case 'a':
+ printf("case a\n");
+ if(optarg == NULL) {
+ printf("empty optarg\n");
+ } else {
+ printf("optarg: %s\n", optarg);
+ samples = atoi(optarg);
+ }
+ if(samples > 1000 || samples <= 0) {
+ printf("Please specify a reasonable number of samples\n");
+ exit(1);
+ }
+ printf("samples: %d\n", samples);
+ sleep_time = 1000000/samples;
+ break;
+ default:
+ usage(argv[0]);
+ return 1;
+ }
+ }
+
+ apminfo = (APMInfo *) malloc(sizeof(APMInfo));
+
+ power_init();
+ /* we want to acquire samples over some period of time, so . . . */
+ for(i = 0; i < samples + 2; i++) {
+ for(j = 0; j < batt_count; j++)
+ acquire_batt_info(j);
+ acquire_global_info();
+ usleep(sleep_time);
+ }
+
+ if(apminfo->power == AC) {
+ printf("On AC Power");
+ for(i = 0; i < batt_count; i++) {
+ binfo = &batteries[i];
+ if(binfo->present && binfo->charging) {
+ printf("; Battery %s charging", binfo->name);
+ printf(", %2d:%02d remaining", binfo->charge_time/60,
+ binfo->charge_time%60);
+ }
+ }
+ printf("\n");
+ } else if(apminfo->power == BATT) {
+ printf("On Battery");
+ for(i = 0; i < batt_count; i++) {
+ binfo = &batteries[i];
+ if(binfo->present)
+ printf(", Battery %s at %d%%", binfo->name,
+ binfo->percentage);
+ }
+ printf("; %d:%02d remaining\n", apminfo->rtime/60,
+ apminfo->rtime%60);
+ }
+ return 0;
+}
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..527b8c0
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,105 @@
+wmacpi-ng (0.50-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Sun, 6 Jul 2003 16:50:59 +1000
+
+wmacpi-ng (0.19-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Wed, 2 Jul 2003 00:55:36 +1000
+
+wmacpi-ng (0.15-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Tue, 24 Jun 2003 00:38:26 +1000
+
+wmacpi-ng (0.14-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Tue, 24 Jun 2003 00:00:26 +1000
+
+wmacpi-ng (0.13-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Mon, 23 Jun 2003 23:49:05 +1000
+
+wmacpi-ng (0.12-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Sat, 21 Jun 2003 12:24:43 +1000
+
+wmacpi-ng (0.11-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at hollie.himi.private> Fri, 30 May 2003 23:42:12 +1000
+
+wmacpi-ng (0.10-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at dreamcraft.com.au> Fri, 30 May 2003 13:35:50 +1000
+
+wmacpi-ng (0.2a-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Simon Fowler <simon at dreamcraft.com.au> Mon, 26 May 2003 22:08:45 +1000
+
+wmacpi-ng (0.2-1) unstable; urgency=low
+
+ * New version.
+
+ -- Simon Fowler <simon at dreamcraft.com.au> Mon, 26 May 2003 18:59:16 +1000
+
+wmacpi-ng (0.1-1) unstable; urgency=low
+
+ * New package, since the current version doesn't work with kernel
+ 2.4.21-rc2.
+
+ -- Simon Fowler <simon at dreamcraft.com.au> Mon, 26 May 2003 14:01:40 +1000
+
+wmacpi (1.34-1) unstable; urgency=low
+
+ * New maintainer.
+ * New upstream release (closes: #143387).
+ * debian/control:
+ - Updated description.
+ - Bumped Standards-Version to 3.5.9.
+ - Updated build-dependency on debhelper to >= 4.
+ - Changed priority to "optional".
+ - Added a recommendation on "wmaker".
+ * debian/compat:
+ - Introduced this file and set its contents to "4".
+ * debian/copyright:
+ - Updated maintainer and homepage infos.
+ * debian/rules:
+ - Made some minor modifications to comply with policy.
+ * debian/watch:
+ - Introduced this file, which seems to be currently useless, though. the
+ web server does not allow browsing in the necessary directories.
+ * debian/docs:
+ - Included AUTHORS.
+ * debian/wmacpi.1:
+ - Updated man page to reflect current parameters of wmacpi.
+
+ -- Sebastian Henschel <shensche at kodeaffe.de> Sat, 19 Apr 2003 17:09:11 +0200
+
+wmacpi (1.33-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Simon Richter <sjr at debian.org> Mon, 28 May 2001 01:49:55 +0200
+
+wmacpi (1.31-1) unstable; urgency=low
+
+ * Initial Release (Closes: #90347).
+
+ -- Simon Richter <Simon.Richter at phobos.fs.tum.de> Mon, 19 Mar 2001 23:26:49 +0100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..d6d72a8
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,21 @@
+Source: wmacpi-ng
+Section: x11
+Priority: optional
+Maintainer: Simon Fowler <simon at dreamcraft.com.au>
+Build-Depends: debhelper (>= 4), xlibs-dev
+Standards-Version: 3.5.9
+
+Package: wmacpi-ng
+Architecture: i386
+Depends: ${shlibs:Depends}
+Recommends: wmaker
+Description: An ACPI battery monitor for WindowMaker
+ This is a battery monitor that uses ACPI to query the battery status. As
+ the interface to ACPI changes rather often, this program usually only works
+ with a very specific kernel version.
+ .
+ This is a reworked version to handle kernel version 2.4.21-rc2, done
+ by Simon Fowler <simon at dreamcraft.com.au>
+ .
+ Author: Tim Copperfield <timecop at japan.co.jp>
+ Homepage: http://www.ne.jp/asahi/linux/timecop/
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..dfd7321
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,27 @@
+This package was debianized by Simon Richter <Simon.Richter at phobos.fs.tum.de> on
+Mon, 19 Mar 2001 23:26:49 +0100.
+It was taken over by Sebastian Henschel <shensche at kodeaffe.de> on Sat, 19 Apr 2003 15:31:00 +0200.
+
+It was downloaded from http://www.ne.jp/asahi/linux/timecop/
+
+Upstream Author: Timecop <timecop at japan.co.jp>
+
+Copyright:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 dated June, 1991.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..e772481
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..9bce069
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+README
+AUTHORS
+TODO
\ No newline at end of file
diff --git a/debian/menu b/debian/menu
new file mode 100644
index 0000000..e76a272
--- /dev/null
+++ b/debian/menu
@@ -0,0 +1,2 @@
+?package(wmacpi-ng):needs=X11 section=Apps/System\
+ title="wmacpi-ng" command="/usr/bin/wmacpi-ng"
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..97fa83f
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,90 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+INSTALLDIR=$(CURDIR)/debian/wmacpi-ng
+
+# These are used for cross-compiling and for saving the configure script
+# # from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS = "-Wall -g -O0"
+else
+ CFLAGS = "-Wall -g -O2"
+endif
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+
+ touch configure-stamp
+
+build: configure-stamp build-stamp
+build-stamp:
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean-all
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/wmacpi.
+ install -o root -g root -m 755 wmacpi-ng $(INSTALLDIR)/usr/bin/
+ install -o root -g root -m 755 acpi-ng $(INSTALLDIR)/usr/bin/
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+# dh_installdebconf
+ dh_installdocs
+# dh_installexamples
+ dh_installmenu
+# dh_installemacsen
+# dh_installpam
+# dh_installinit
+# dh_installcron
+ dh_installman debian/wmacpi-ng.1
+# dh_installinfo
+# dh_undocumented
+ dh_installchangelogs ChangeLog
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_makeshlibs
+ dh_installdeb
+# dh_perl
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..ff95adf
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=2
+http://www.ne.jp/asahi/linux/timecop/software/wmacpi-(.*)\.tar\.gz debian uupdate
diff --git a/debian/wmacpi-ng.1 b/debian/wmacpi-ng.1
new file mode 100644
index 0000000..800f506
--- /dev/null
+++ b/debian/wmacpi-ng.1
@@ -0,0 +1,125 @@
+.TH WMACPI-NG 1 "May 30, 2003"
+.SH NAME
+wmacpi-ng \- Battery status monitor for systems supporting ACPI
+.SH NAME
+acpi-ng \- Query battery status for systems supporting ACPI
+.SH SYNOPSIS
+.B wmacpi-ng
+[
+.RI -b
+]
+[
+.RI -c
+value ]
+[
+.RI -d
+display ]
+[
+.RI -m
+battery no ]
+[
+.RI -v
+]
+[
+.RI -V
+]
+[
+.RI -h
+]
+.PP
+.B acpi-ng
+[
+.RI -a
+samples ]
+[
+.RI -v
+]
+[
+.RI -V
+]
+[
+.RI -h
+]
+.SH DESCRIPTION
+This manual page documents briefly the
+.B wmacpi-ng
+command.
+.PP
+.B wmacpi-ng
+is a program that displays the current battery status in a WindowMaker
+dock app, on systems that support Intel's Advanced Configuration and
+Power Interface specification (ACPI).
+.PP
+The program monitors a battery, displaying its current percentage
+charge via a bar and a numeric value. It also displays the current
+power status for the system, the time remaining (calculated based on
+the remaining battery capacity and the current rate of power usage),
+and a scrolling message with some hopefully useful information.
+.PP
+Clicking on the window cycles through the batteries that the ACPI
+system knows about.
+.PP
+.B acpi-ng
+queries the battery status from the command line. It prints the power
+status, the percentage remaining for each battery found, and the time
+remaining if the system is on battery, or the time remaining for each
+battery to reach full charge if the batteries are charging.
+.SH OPTIONS
+.B wmacpi-ng
+.TP
+.B \-b
+Make noise when battery is critical low (beep).
+.TP
+.B \-c value
+Set critical low alarm at <value>% (default: 10%).
+.TP
+.B \-d
+Set the X display to open the window on.
+.TP
+.B \-m
+Set the battery to monitor initially.
+.TP
+.B \-v
+Increase the verbosity of the program. Can be used more than once -
+each successive use increases the verbosity.
+.TP
+.B \-V
+Print the version information.
+.TP
+.B \-h
+Display help.
+.TP
+.B acpi-ng
+.TP
+.B \-a num
+Average the time remaining over num samples. This greatly improves the
+accuracy of the reported time remaining.
+.TP
+.B \-v
+Increase the verbosity of the program, as for
+.B wmacpi-ng
+.TP
+.B \-V
+Print the version information.
+.TP
+.B \-h
+Display help.
+.TP
+.SH SEE ALSO
+.BR wmapm (1)
+.br
+.SH AUTHOR
+.B wmacpi
+as written by Tim Copperfield <timecop at japan.co.jp>.
+.B wmacpi-ng
+is a reworking of
+.B wmacpi 1.34
+to support recent kernel versions, performed by Simon Fowler
+<simon at dreamcraft.com.au>.
+.PP
+This manual page was originally written by Simon Richter
+<sjr at debian.org> for the Debian GNU/Linux system, and then updated for
+.B wmacpi-ng
+by Simon Fowler.
+.br
+Last modification by Simon Fowler <simon at dreamcraft.com.au>, 2003-05-30.
diff --git a/libacpi.c b/libacpi.c
index 120a157..e619143 100644
--- a/libacpi.c
+++ b/libacpi.c
@@ -1,21 +1,16 @@
+#define _GNU_SOURCE
+
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
-#include "wmacpi.h"
-
-#define MAXBATT 8
+#include "libacpi.h"
-#ifdef ACPI
-#ifdef PRO
extern char *state[];
-#endif
extern APMInfo *apminfo;
-static char batteries[MAXBATT][128];
-static char battinfo[MAXBATT][128];
-int batt_count;
/* temp buffer */
char buf[512];
@@ -29,7 +24,9 @@ int power_init(void)
char buf[4096];
DIR *battdir;
struct dirent *batt;
- char *name;
+ char *name, *tmp1, *tmp2;
+ char *names[MAXBATT];
+ int i, j;
int acpi_ver = 0;
if (!(acpi = fopen("/proc/acpi/info", "r"))) {
@@ -40,7 +37,7 @@ int power_init(void)
/* okay, now see if we got the right version */
fread(buf, 4096, 1, acpi);
acpi_ver = strtol(buf + 25, NULL, 10);
- eprint(1, "ACPI version detected: %d\n", acpi_ver);
+ eprint(0, "ACPI version detected: %d\n", acpi_ver);
if (acpi_ver < 20020214) {
fprintf(stderr, "This version requires ACPI subsystem version 20020214\n");
fclose(acpi);
@@ -58,149 +55,373 @@ int power_init(void)
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 .. */
if (!strncmp(".", name, 1) || !strncmp("..", name, 2))
continue;
- sprintf(batteries[batt_count], "/proc/acpi/battery/%s/state", name);
- sprintf(battinfo[batt_count], "/proc/acpi/battery/%s/info", name);
- eprint(1, "battery detected at %s\n", batteries[batt_count]);
+ names[batt_count] = strdup(name);
batt_count++;
}
closedir(battdir);
+ /* A nice quick insertion sort, ala CLR. */
+ for (i = 1; i < batt_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 < batt_count; i++) {
+ snprintf(batteries[i].name, MAX_NAME, "%s", names[i]);
+ snprintf(batteries[i].info_file, MAX_NAME,
+ "/proc/acpi/battery/%s/info", names[i]);
+ snprintf(batteries[i].state_file, MAX_NAME,
+ "/proc/acpi/battery/%s/state", names[i]);
+ eprint(0, "battery detected at %s\n", batteries[i].info_file);
+ fprintf(stderr, "found battery %s\n", names[i]);
+ }
+
/* tell user some info */
- eprint(1, "%d batteries detected\n", batt_count);
+ eprint(0, "%d batteries detected\n", batt_count);
fprintf(stderr, "wmacpi: found %d batter%s\n", batt_count,
(batt_count == 1) ? "y" : "ies");
return 0;
}
-int acpi_get_design_cap(int battery)
+char *get_value(char *string)
{
- FILE *acpi;
- char *ptr;
- int design_cap;
+ char *retval;
+ int i;
+
+ if (string == NULL)
+ return NULL;
- if (battery > MAXBATT)
- return -1;
+ i = 0;
+ while (string[i] != ':') i++;
+ while (!isalnum(string[i])) i++;
+ retval = (string + i);
- if (!(acpi = fopen(battinfo[battery], "r")))
- return -1;
+ return retval;
+}
+
+power_state_t get_power_status(void)
+{
+ FILE *file;
+ char buf[1024];
+ char *val;
- fread(buf, 512, 1, acpi);
- fclose(acpi);
+ if ((file = fopen("/proc/acpi/ac_adapter/AC/state", "r")) == NULL) {
+ perror("Could not open /proc/acpi/ac_adapter/AC/state\n");
+ return PS_ERR;
+ }
+
+ fgets(buf, 1024, file);
+ fclose(file);
+ val = get_value(buf);
+ if ((strncmp(val, "on-line", 7)) == 0)
+ return AC;
+ else
+ return BATT;
+}
+
+int get_battery_info(int batt_no)
+{
+ FILE *file;
+ battery *info = &batteries[batt_no];
+ char buf[1024];
+ char *entry;
+ int buflen;
+ char *val;
- if ((ptr = strstr(buf, "last full capacity"))) {
- ptr += 25;
- sscanf(ptr, "%d", &design_cap);
- eprint(1, "last full capacity: %d\n", design_cap);
+ if ((file = fopen(info->info_file, "r")) == NULL) {
+ /* this is cheating, but string concatenation should work . . . */
+ fprintf(stderr, "Could not open %s:", info->info_file );
+ perror(NULL);
+ return 0;
+ }
+
+ /* grab the contents of the file */
+ buflen = fread(buf, sizeof(buf), 1, file);
+ fclose(file);
+
+ /* check to see if battery is present */
+ entry = strstr(buf, "present:");
+ val = get_value(entry);
+ if ((strncmp(val, "yes", 3)) == 0) {
+ info->present = 1;
} else {
- /* hack. if there isnt any info on last capacity, we are
- * screwed, but let's not come back here again */
- design_cap = -1;
- eprint(1, "Cannot retrieve design capacity!");
+ eprint(0, "Battery %s not present\n", info->name);
+ info->present = 0;
+ return 0;
}
- return design_cap;
-}
+ /* get design capacity
+ * note that all these integer values can also contain the
+ * string 'unknown', so we need to check for this. */
+ entry = strstr(buf, "design capacity:");
+ val = get_value(entry);
+ if (val[0] == 'u')
+ info->design_cap = -1;
+ else
+ info->design_cap = strtoul(val, NULL, 10);
-void acquire_info(void)
-{
- FILE *acpi;
- char *ptr;
- char stat;
+ /* get last full capacity */
+ entry = strstr(buf, "last full capacity:");
+ val = get_value(entry);
+ if (val[0] == 'u')
+ info->last_full_cap = -1;
+ else
+ info->last_full_cap = strtoul(val, NULL, 10);
- static int dcap = 0xdeadbeef;
+ /* get design voltage */
+ entry = strstr(buf, "design voltage:");
+ val = get_value(entry);
+ if (val[0] == 'u')
+ info->design_voltage = -1;
+ else
+ info->design_voltage = strtoul(val, NULL, 10);
- int percent = 100; /* battery percentage */
- int ptemp, rate, rtime = 0;
+
+ if ((file = fopen(info->state_file, "r")) == NULL) {
+ fprintf(stderr, "Could not open %s:", info->state_file );
+ perror(NULL);
+ return 0;
+ }
+
+ /* grab the file contents */
+ buflen = fread(buf, sizeof(buf), 1, file);
+ fclose(file);
- if (dcap == 0xdeadbeef) {
- /* get from first battery for now */
- dcap = acpi_get_design_cap(0);
+ /* check to see if battery is present */
+ entry = strstr(buf, "present:");
+ val = get_value(entry);
+ if ((strncmp(val, "yes", 3)) == 0) {
+ info->present = 1;
+ } else {
+ info->present = 0;
+ eprint(1, "Battery %s no longer present\n", info->name);
+ 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 ((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);
+ if ((strncmp(val, "discharging", 10)) == 0)
+ info->charging = 0;
+ else
+ info->charging = 1;
+
+ /* get current rate of burn
+ * note that if it's on AC, this will report 0 */
+ entry = strstr(buf, "present rate:");
+ val = get_value(entry);
+ if (val[0] == 'u') {
+ info->present_rate = -1;
+ } else {
+ int rate;
+ rate = strtoul(val, NULL, 10);
+ if (rate != 0)
+ info->present_rate = rate;
}
- if (!(acpi = fopen(batteries[0], "r")))
+ /* get remaining capacity */
+ entry = strstr(buf, "remaining capacity:");
+ val = get_value(entry);
+ if (val[0] == 'u')
+ info->remaining_cap = -1;
+ else
+ info->remaining_cap = strtoul(val, NULL, 10);
+
+ /* get current voltage */
+ entry = strstr(buf, "present voltage:");
+ val = get_value(entry);
+ if (val[0] == 'u')
+ info->present_voltage = -1;
+ else
+ info->present_voltage = strtoul(val, NULL, 10);
+
+ return 1;
+}
+
+/*
+ * 2003-7-1.
+ * In order to make this code more convenient for things other than
+ * just plain old wmacpi-ng I'm breaking the basic functionality
+ * up into several chunks: collecting and collating info for a
+ * single battery, calculating the global info (such as rtime), and
+ * some stuff to provide a similar interface to now.
+ */
+
+void acquire_batt_info(int batt)
+{
+ float rcap, lfcap;
+ battery *binfo;
+
+ get_battery_info(batt);
+
+ binfo = &batteries[batt];
+
+ if (!binfo->present) {
+ binfo->percentage = 0;
+ binfo->valid = 0;
+ binfo->charge_time = 0;
+ apminfo->rtime = 0;
return;
+ }
- eprint(1, "opened acpi file successfully");
- fread(buf, 512, 1, acpi);
- fclose(acpi);
+ /* calculate the percentage remaining, using the values of
+ * remaining capacity and last full capacity, as outlined in
+ * the ACPI spec v2.0a, section 3.9.3. */
+ {
+ rcap = (float)binfo->remaining_cap;
+ lfcap = (float)binfo->last_full_cap;
+ if (rcap <= 0)
+ rcap = 0;
+ if (lfcap <= 0)
+ lfcap = 1;
+ binfo->percentage = (int)((rcap/lfcap) * 100.0);
+ eprint(0, "percent: %d\n", binfo->percentage);
+ }
- /* This section of the code will calculate "percentage remaining"
- * using battery capacity, and the following formula (acpi spec 3.9.2):
- * percentage = (current_capacity / last_full_capacity) * 100; */
- if ((ptr = strstr(buf, "remaining capacity"))) {
- ptr += 25;
- sscanf(ptr, "%d", &ptemp);
- eprint(1, "capacity: %d\n", ptemp);
- percent = (float)((float)ptemp / (float)dcap) * 100;
- eprint(1, "percent: %d\n", percent);
- }
- apminfo->percentage = percent;
-
- /* this section of code will calculate "time remaining"
- * using battery remaining capacity, and battery "rate" (3.9.3) */
- if ((ptr = strstr(buf, "present rate"))) {
- ptr += 25;
- sscanf(ptr, "%d", &rate);
- eprint(1, "rate: %d\n", rate);
- if (rate <= 0)
- rate = 0;
- /* time remaining in minutes */
- rtime = ((float)((float)ptemp / (float)rate)) * 60;
- if (rtime <= 0)
- rtime = 0;
- eprint(1, "time rem: %d\n", rtime);
- }
- apminfo->rtime = rtime;
-
- if ((ptr = strstr(buf, "charging state"))) {
- /* found battery discharging. This is used to determine if
- * we are on AC power or not. Notice check for "ch" later on */
- stat = *(ptr + 25);
- if (stat == 'o' || stat == 'u') /* "ok" | "unknown" : charged, on ac power */
- apminfo->power = POWER;
- else
- /* we set this, and later on use percentage
- * value to determine high/med/low */
- apminfo->power = HIGH;
-
- /* but if we are on power, we might be charging too. Check. */
- if ((ptr = strstr(buf, "charging state"))) {
- /* found battery charging line. We will change power state
- * if we are on power, and charging. */
- stat = *(ptr + 25);
- /* this is seriously stupid - but we catch "critical" */
- if (stat == 'c' && (*(ptr + 26) == 'h'))
- apminfo->power = CHARGING;
+ /* set the battery's capacity state, based (at present) on some
+ * guesstimated values: more than 75% == HIGH, 25% to 75% MED, and
+ * less than 25% is LOW. Less than apminfo->crit_level is CRIT. */
+ if (binfo->percentage > 75)
+ binfo->state = HIGH;
+ else if (binfo->percentage > 25)
+ binfo->state = MED;
+ else
+ /* we only go to critical state if the battery is reporting
+ * critical itself . . . */
+ binfo->state = LOW;
+
+ /* we need to /know/ that we've got a valid state for the
+ * apminfo->power value . . . .*/
+ apminfo->power = get_power_status();
+
+ if ((apminfo->power != AC) && !binfo->charging) {
+ /* 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) {
+ eprint(1, "Received critical battery status");
+ apminfo->power = CRIT;
}
}
+
+ if (binfo->charging) {
+ /* calculate remaining time until the battery is charged.
+ * when charging, the battery state file reports the
+ * current being used to charge the battery. We can use
+ * this and the remaining capacity to work out how long
+ * until it reaches the last full capacity of the battery.
+ * XXX: make sure this is actually portable . . . */
+ lfcap = (float)binfo->last_full_cap;
+ rcap = (float)binfo->remaining_cap;
+
+ binfo->charge_time = (int)(((lfcap - rcap)/binfo->present_rate) * 60.0);
+ } else
+ if (binfo->charge_time)
+ binfo->charge_time = 0;
- /* we are not on power, and not charging. So, it would make sense
- * to check if battery is "critical low", and calculate interesting
- * things like battery HIGH/LOW, and maybe battery usage LOAD
- * This will be replaced with some code to allow setting user-specified
- * low / critical alarms */
- if ((apminfo->power != POWER) && (apminfo->power != CHARGING)) {
- eprint(1, "entering battery status check");
- if ((ptr = strstr(buf, "capacity state"))) {
- stat = *(ptr + 25);
- /* only check "c" here because we already caught "CHarging" earlier
- * and also look into crit_level */
- if (stat == 'c' || (apminfo->percentage <= apminfo->crit_level)) {
- /* nothing else to do here - critical battery. get out */
- eprint(1, "Received critical battery status");
- apminfo->power = CRIT;
+ /* and finally, we tell anyone who wants to use this information
+ * that it's now valid . . .*/
+ binfo->valid = 1;
+}
+
+void acquire_all_batt_info(void)
+{
+ int i;
+
+ for(i = 0; i < batt_count; i++)
+ acquire_batt_info(i);
+}
+
+void acquire_global_info(void)
+{
+ int i;
+ int rtime;
+ float rcap = 0;
+ float rate = 0;
+ static float rate_samples[SAMPLES];
+ static int j = 0;
+ static int sample_count = 0;
+ static int n = 0;
+
+ /* calculate the time remaining, using the battery's remaining
+ * capacity and the reported burn rate (3.9.3).
+ * For added accuracy, we average the value over the last
+ * SAMPLES number of calls, or for anything less than this we
+ * simply report the raw number. */
+ {
+
+ for (i = 0; i < batt_count; i++) {
+ if (batteries[i].present && batteries[i].valid) {
+ rcap += (float)batteries[i].remaining_cap;
+ rate += (float)batteries[i].present_rate;
}
}
+ rate_samples[j] = rate;
+ j++, sample_count++;
+ j = j % SAMPLES;
+
+ /* for the first SAMPLES number of calls we calculate the
+ * average based on sample_count, then we use SAMPLES to
+ * calculate the rolling average. */
+
+ /* when this fails, n should be equal to SAMPLES. */
+ if (sample_count < SAMPLES)
+ n++;
+ for (i = 0, rate = 0; i < n; i++)
+ rate += rate_samples[i];
+ rate = rate/n;
+
+ if ((rcap < 1) || (rate < 1)) {
+ rtime = 0;
+ goto out;
+ }
+ if (rate <= 0)
+ rate = 1;
+ /* time remaining in minutes */
+ rtime = (int)((rcap/rate) * 60.0);
+ if(rtime <= 0)
+ rtime = 0;
+ out:
+ eprint(0, "time rem: %d\n", rtime);
+ apminfo->rtime = rtime;
}
- process_plugin_timer();
- eprint(1, "current state: %s (%d)", state[apminfo->power], apminfo->power);
+ /* get the power status.
+ * note that this is actually reported seperately from the
+ * battery info, under /proc/acpi/ac_adapter/AC/state */
+ apminfo->power = get_power_status();
+}
+
+void acquire_all_info(void)
+{
+ acquire_all_batt_info();
+ acquire_global_info();
}
-#endif /* ACPI */
diff --git a/libacpi.h b/libacpi.h
new file mode 100644
index 0000000..0867711
--- /dev/null
+++ b/libacpi.h
@@ -0,0 +1,118 @@
+#ifndef _LIBACPI_H_
+#define _LIBACPI_H_
+
+
+#define LIBACPI_VER "0.50"
+
+/* Here because we need it for definitions in this file . . . */
+#define MAX_NAME 128
+#define MAXBATT 8
+#define SAMPLES 50
+
+typedef enum {
+ REMAIN,
+ TIMER
+} DspMode;
+
+typedef enum {
+ BLINK,
+ OFF
+} Mode;
+
+typedef enum {
+ AC,
+ BATT,
+ PS_ERR,
+} power_state_t;
+
+typedef enum {
+ HIGH,
+ MED,
+ LOW,
+ CRIT,
+} batt_state_t;
+
+typedef enum {
+ OK,
+ CRITICAL,
+} cap_state_t;
+
+typedef struct {
+ /* general info */
+ char name[MAX_NAME];
+ /* these two are conveniences */
+ char info_file[MAX_NAME];
+ char state_file[MAX_NAME];
+ int present;
+ int design_cap; /* assuming mAh */
+ int last_full_cap;
+ int design_voltage; /* in mV */
+ /* state info */
+ cap_state_t capacity_state;
+ int charging;
+ int present_rate; /* in mAh */
+ int remaining_cap; /* in mAh */
+ int present_voltage; /* in mV */
+ /* calculated states */
+ batt_state_t state;
+ int percentage; /* stored here because this is a per battery thing */
+ int charge_time; /* time left to charge this battery */
+ /* and a flag to indicate that this is valid . . . */
+ int valid;
+} battery;
+
+typedef struct {
+ power_state_t power; /* On AC or not? */
+ int rtime; /* remaining time */
+ int timer; /* how long been on battery? */
+ int crit_level; /* anything below this is critical low */
+ battery *binfo; /* pointer to the battery being monitored */
+} APMInfo;
+
+/*
+ * Note that there are some serious problems with this: firstly, handling of
+ * multiple batteries sucks. I've cleaned it up a reasonable amount so far,
+ * but I don't know enough about how multiple batteries are handled in the
+ * actual power management code to be able to do it right. I need to plug
+ * in the second battery for this LifeBook to see how it goes . . .
+ *
+ * Moving percentage to the battery is right, but I think we need a global
+ * remaining capacity somewhere, too . . .
+ */
+
+/*
+ * To provide a convenient debugging function . . .
+ */
+
+static int verbosity = 0;
+
+#define eprint(level, fmt, arg...) \
+ do { \
+ if (level > verbosity) { \
+ switch (level) { \
+ case 0: \
+ break; \
+ case 1: \
+ fprintf(stderr, fmt, ##arg); \
+ break; \
+ default: \
+ fprintf(stderr, "%s: " fmt, __FUNCTION__, ##arg); \
+ fprintf(stderr, "\n"); \
+ break; \
+ } \
+ } \
+ } while (0)
+
+/* since these /are/ needed here . . . */
+battery batteries[MAXBATT];
+int batt_count;
+
+/* check if apm/acpi is enabled, etc */
+int power_init(void);
+/* fill APMInfo with data */
+void acquire_batt_info(int);
+void acquire_all_batt_info(void);
+void acquire_global_info(void);
+void acquire_all_info(void);
+
+#endif /* _WMACPI_H_ */
diff --git a/libapm.c b/libapm.c
deleted file mode 100644
index 684da76..0000000
--- a/libapm.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <stdio.h>
-#include "wmacpi.h"
-
-#ifdef APM
-#ifdef PRO
-extern char *state[];
-#endif
-extern APMInfo *apminfo;
-extern int crit_level;
-
-int power_init(void)
-{
- FILE *apm;
-
- if (!(apm = fopen("/proc/apm", "r"))) {
- fprintf(stderr, "This system does not support APM\n");
- return 1;
- }
- fclose(apm);
-
- return 0;
-}
-
-void acquire_info(void)
-{
- FILE *apm;
- char buf[256];
- char min[10];
-
- int ac_line, batt, percent, rtime;
-
-#ifdef PRO
- /* testing */
- if (!(apm = fopen("apm", "r")))
- return;
-#else
- if (!(apm = fopen("/proc/apm", "r")))
- return;
-#endif
-
- fgets(buf, 255, apm);
- sscanf(buf, "%*s %*s %*s %x %x %*s %d%% %d %s",
- &ac_line, &batt, &percent, &rtime, min);
-
- eprint(0, "%02x %02x, %03d%%, %d", ac_line, batt, percent, rtime);
- apminfo->percentage = percent;
- apminfo->rtime = rtime;
-
- switch (ac_line) {
- case 0: /* on battery. calculate status. handle charging under AC */
- switch (batt) {
- case 0:
- apminfo->power = HIGH;
- break;
- case 1:
- apminfo->power = LOW;
- break;
- case 2:
- apminfo->power = CRIT;
- break;
- }
-
- /* check user-defined critical alarm */
- if (apminfo->percentage <= apminfo->crit_level)
- apminfo->power = CRIT;
-
- break;
- case 1: /* on AC power. Check if battery is being charged */
-#ifdef RETARDED_APM
- /* this is incase your battery is "charging" all the fucking time,
- * even when it's actually done charging */
- if ((batt == 3) && (percent != 100))
-#else
- if (batt == 3)
-#endif
- apminfo->power = CHARGING;
- else
- apminfo->power = POWER;
- break;
-#ifdef STUPID_APM
- /* treatment for GAY apm bioses that show wrong time
- * remaining when AC is plugged in */
- apminfo->rtime = 0;
-#endif
- }
- fclose(apm);
- process_plugin_timer();
-
- eprint(1, "current state: %s (%d)", state[apminfo->power], apminfo->power);
-}
-#endif /* APM */
diff --git a/master.xpm b/master.xpm
index 30c5d58..cb1cddd 100644
--- a/master.xpm
+++ b/master.xpm
@@ -1,6 +1,6 @@
/* XPM */
static char * master_xpm[] = {
-"157 88 116 2",
+"157 88 100 2",
" c None",
". c #000000",
"+ c #FF0000",
@@ -97,26 +97,10 @@ static char * master_xpm[] = {
".. c #20B2AE",
"+. c #004941",
"@. c #188A86",
-"#. c #DAF5B2",
-"$. c #355600",
-"%. c #FEFFFF",
-"&. c #AAAFA9",
-"*. c #315900",
-"=. c #D0D2D1",
-"-. c #FDFEF6",
-";. c #FF2D00",
-">. c #DA0710",
-",. c #F3FFF9",
-"'. c #A5F812",
-"). c #A7ACB2",
-"!. c #4F5354",
-"~. c #87F91F",
-"{. c #94F625",
-"]. c #C0C6BC",
-"^. c #22B2AE",
-"/. c #027E72",
-"(. c #034A40",
-"_. c #107D79",
+"#. c #22B2AE",
+"$. c #107D79",
+"%. c #027E72",
+"&. c #034A40",
" . + @ # $ % & * = - % ; > , ' % ) ! ~ { % ] ^ / ( % _ : < [ % } | 1 2 % 3 4 5 6 % 7 8 9 0 % a b c d % e f g h ",
" . + @ # $ % & * = - % ; > , ' % ) ! ~ { % ] ^ / ( % _ : < [ % } | 1 2 % 3 4 5 6 % 7 8 9 0 % a b c d % e f g h ",
" . + @ # $ % & * = - % ; > , ' % ) ! ~ { % ] ^ / ( % _ : < [ % } | 1 2 % 3 4 5 6 % 7 8 9 0 % a b c d % e f g h ",
@@ -147,61 +131,61 @@ static char * master_xpm[] = {
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % ......% % % +.+.+. 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 .% % ` ",
+" . % % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % ` % #.% % % #.% % +.% % % % +.% % ` . % % % ......% % % % ..% % % % ..% % % % % % % % ....% % @.% @.+.+.+. at .% @.+.+.+. at .% % % ..% % % % % % % % % % % +.% % % % ..% % ` % % % % % % % % +.% % % % ..% % ` ",
+" . % % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % ` % #.#.#.#.% % % % +.+.+.+.% % % ` . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% % ..% ..% % % ..% ..% % % ..% % ..% ..% % % #.#.#.#.% % % +.% % % % ..% % ` % #.#.#.#.% % % +.% % % % ..% % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % % ..........% % % % ..% % % % % % % % ..% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % #.% % % #.% % +.% % % % ..% % ` % #.% % % #.% % +.% % % % ..% % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % % % % % % % % % % % ....................% % % @.% % ......% % % ......% % % % % ..% % % #.% % % #.% % +.% % % % ..% % ` % #.% % % #.% % +.% % % % ..% % ` ",
+" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #.% % % #.% % % +.+.+.+.$.% % ` % #.% % % #.% % $.........$.% % ` ",
+" . % #.#.#.#.% % % +.% % % % ..% % ` % #.#.#.#.% % % ..% % % % +.% % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #.% % % #.% % +.% % % % ..% % ` % #.% % % #.% % ..% % % % +.% % ` ",
+" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % % % % % +.+.+.+.+.% % % % +.+.+.+.+.+.+.+.+.+.% % % % % % +.+.+.% % % +.+.+.% % % +.% % % % % #.% % % #.% % +.% % % % ..% % ` % #.% % % #.% % ..% % % % +.% % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % +.% % % % +.+.+.% % +.% % % % % % % % +.% % % +.% +.% % % +.% +.% % % +.% +.% +.% +.% % #.% % % #.% % +.% % % % ..% % ` % #.% % % #.% % ..% % % % +.% % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % +.% % % % +.% % % % +.% % % % % % % % +.+.% % +.% +.% % % +.% +.% % % +.% % +.% +.% % % #.#.#.#.% % % % +.+.+.+.$.% % ` % #.#.#.#.% % % $.........$.% % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % +.+.+.% % % % +.% % % % +.% % % % % % % % +.+.% % % % % +.+.+.% % % +.+.+.% % % % +.% % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % +.% % +.% % % % +.+.+.% % +.% % % % % % % % +.+.% % +.% +.% % % +.% +.% % % +.% % +.% +.% % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % +.% % % % +.+.+.+.+.% % % % +.% % % % % % % % +.% % % +.% +.% % % +.% +.% % % +.% +.% +.% +.% ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % +.% % % % % % % % % % % % % +.+.+.+.+.+.+.+.+.+.% % % % % % +.+.+.% % % +.+.+.% % % % % +.% % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
-" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % ^.^.^.% % % % % % /.% /.^.^.^./.% /.^.^.^./.% /.% % % /.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% % % % % % % % % % % % % % % % % % % ",
-" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % ^.% % % ^.% % % % % ^.% % % % % ^.% % % % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % % % % % % % ^.% ^.% % % ^.% ^.% % % ^.% % % % % % % % % % % % % % % % % % % ",
-" . % ^.% % % ^.% % % % % ^.% % % % % ^.% % % % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % % % % % % % ^.% ^.% % % ^.% ^.% % % ^.% % % % % % % % % % % % % % % % % % % ",
-" . % /.% % % /.% % % % % /.% /.^.^.^./.% % ^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% % % % % /.% (.^.^.^.(.% /.^.^.^./.% /.^.^.^./.% % % % % % % % % % % % % ",
-" . % ^.% % % ^.% % % % % ^.% ^.% % % % % % % % % ^.% % % % % ^.% % % % % ^.% ^.% % % ^.% % % % % ^.% ^.% % % ^.% % % % % ^.% % % % % % % % % % % % % % % % % % % ",
-" . % ^.% % % ^.% % % % % ^.% ^.% % % % % % % % % ^.% % % % % ^.% % % % % ^.% ^.% % % ^.% % % % % ^.% ^.% % % ^.% % % % % ^.% % % % % % % % % % % % % % % % % % % ",
-". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % ^.^.^.% % % % % % ^.% /.^.^.^./.% /.^.^.^./.% % % % % /.% /.^.^.^./.% /.^.^.^./.% % % % % /.% /.^.^.^./.% /.^.^.^./.% % % % % % % % % % % % % % % % % ^.% ",
+" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % #.#.#.% % % % % % %.% %.#.#.#.%.% %.#.#.#.%.% %.% % % %.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% % % % % % % % % % % % % % % % % % % ",
+" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % #.% % % #.% % % % % #.% % % % % #.% % % % % #.% #.% % % #.% #.% % % % % #.% % % % % % % % % #.% #.% % % #.% #.% % % #.% % % % % % % % % % % % % % % % % % % ",
+" . % #.% % % #.% % % % % #.% % % % % #.% % % % % #.% #.% % % #.% #.% % % % % #.% % % % % % % % % #.% #.% % % #.% #.% % % #.% % % % % % % % % % % % % % % % % % % ",
+" . % %.% % % %.% % % % % %.% %.#.#.#.%.% % #.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% % % % % %.% &.#.#.#.&.% %.#.#.#.%.% %.#.#.#.%.% % % % % % % % % % % % % ",
+" . % #.% % % #.% % % % % #.% #.% % % % % % % % % #.% % % % % #.% % % % % #.% #.% % % #.% % % % % #.% #.% % % #.% % % % % #.% % % % % % % % % % % % % % % % % % % ",
+" . % #.% % % #.% % % % % #.% #.% % % % % % % % % #.% % % % % #.% % % % % #.% #.% % % #.% % % % % #.% #.% % % #.% % % % % #.% % % % % % % % % % % % % % % % % % % ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % #.#.#.% % % % % % #.% %.#.#.#.%.% %.#.#.#.%.% % % % % %.% %.#.#.#.%.% %.#.#.#.%.% % % % % %.% %.#.#.#.%.% %.#.#.#.%.% % % % % % % % % % % % % % % % % #.% ",
" % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
-"% (.^.^.^.(.% /.^.^.^.% % /.^.^.^./.% /.^.^.^.% % /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.% % % /.% % % /.% % % % % % % /.% /.% % % /.% /.% % % % % ^.% % % ^.% /.^.^.^.% % /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.^.^.^./.% /.% % % /.% /.% % % /.% /.% % % /.% /.% % % /.% /.% % % /.% /.^.^.^./.% ",
-"% ^.% % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % ^.% ^.% % % % % ^.% % % % % ^.% % % % % ^.% % % ^.% % % ^.% % % % % % % ^.% ^.% % % ^.% ^.% % % % % ^.^.% ^.^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % % % % % ^.% % % ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% % % % % ^.% ",
-"% ^.% % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % ^.% ^.% % % % % ^.% % % % % ^.% % % % % ^.% % % ^.% % % ^.% % % % % % % ^.% ^.% % ^.(.% ^.% % % % % ^.% ^.% ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % % % % % ^.% % % ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% (.^.% ^.(.% ^.% % % ^.% % % % ^.(.% ",
-"% /.^.^.^./.% /.^.^.^.% % /.% % % % % /.% % % /.% /.^.^.^.% % /.^.^.^.% % /.(.^.^./.% /.^.^.^./.% % % /.% % % % % % % /.% /.^.^.(.% % /.% % % % % /.% % % /.% /.% % % /.% /.% % % /.% /.^.^.^./.% /.^.% % /.% /.^.^.^.% % /.^.^.^./.% % % /.% % % /.% % % /.% /.% % % /.% /.% % % /.% % (.^.(.% % /.^.^.^./.% % (.^.(.% % ",
-"% ^.% % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % ^.% ^.% % % % % ^.% % % % % ^.% % % ^.% ^.% % % ^.% % % ^.% % % % % % % ^.% ^.% % ^.(.% ^.% % % % % ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % % % ^.% ^.% ^.% ^.% % % ^.% % % % % ^.% % % ^.% % % ^.% % % ^.% ^.% % % ^.% ^.% ^.% ^.% (.^.% ^.(.% % % % % ^.% (.^.% % % % ",
-"% ^.% % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % ^.% ^.% % % % % ^.% % % % % ^.% % % ^.% ^.% % % ^.% % % ^.% % % % % % % ^.% ^.% % % ^.% ^.% % % % % ^.% % % ^.% ^.% % % ^.% ^.% % % ^.% ^.% % % % % ^.% % ^.^.% ^.% % % ^.% % % % % ^.% % % ^.% % % ^.% % % ^.% ^.% % % ^.% ^.^.% ^.^.% ^.% % % ^.% % % % % ^.% ^.% % % % % ",
-"% /.% % % /.% /.^.^.^.% % /.^.^.^./.% ^.^.^.^.% % /.^.^.^./.% ^.% % % % % /.^.^.^./.% /.% % % /.% % % ^.% % % /.^.^.^./.% /.% % % /.% /.^.^.^.(.% /.% % % /.% ^.% % % ^.% /.^.^.^./.% /.% % % % % /.^.^.^./.% /.% % % /.% /.^.^.^./.% % % /.% % % (.^.^.^.^.% % ^.^.^.% % ^.% % % ^.% /.% % % ^.% /.^.^.^./.% /.^.^.^./.% ",
+"% &.#.#.#.&.% %.#.#.#.% % %.#.#.#.%.% %.#.#.#.% % %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.% % % %.% % % %.% % % % % % % %.% %.% % % %.% %.% % % % % #.% % % #.% %.#.#.#.% % %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.#.#.#.%.% %.% % % %.% %.% % % %.% %.% % % %.% %.% % % %.% %.% % % %.% %.#.#.#.%.% ",
+"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % % % #.% % % #.% % % #.% % % % % % % #.% #.% % % #.% #.% % % % % #.#.% #.#.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % % % #.% % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% % % % % #.% ",
+"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % % % #.% % % #.% % % #.% % % % % % % #.% #.% % #.&.% #.% % % % % #.% #.% #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % % % #.% % % #.% % % #.% #.% % % #.% #.% % % #.% &.#.% #.&.% #.% % % #.% % % % #.&.% ",
+"% %.#.#.#.%.% %.#.#.#.% % %.% % % % % %.% % % %.% %.#.#.#.% % %.#.#.#.% % %.&.#.#.%.% %.#.#.#.%.% % % %.% % % % % % % %.% %.#.#.&.% % %.% % % % % %.% % % %.% %.% % % %.% %.% % % %.% %.#.#.#.%.% %.#.% % %.% %.#.#.#.% % %.#.#.#.%.% % % %.% % % %.% % % %.% %.% % % %.% %.% % % %.% % &.#.&.% % %.#.#.#.%.% % &.#.&.% % ",
+"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % #.% #.% % % #.% % % #.% % % % % % % #.% #.% % #.&.% #.% % % % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % #.% #.% #.% #.% % % #.% % % % % #.% % % #.% % % #.% % % #.% #.% % % #.% #.% #.% #.% &.#.% #.&.% % % % % #.% &.#.% % % % ",
+"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % #.% #.% % % #.% % % #.% % % % % % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % #.% % #.#.% #.% % % #.% % % % % #.% % % #.% % % #.% % % #.% #.% % % #.% #.#.% #.#.% #.% % % #.% % % % % #.% #.% % % % % ",
+"% %.% % % %.% %.#.#.#.% % %.#.#.#.%.% #.#.#.#.% % %.#.#.#.%.% #.% % % % % %.#.#.#.%.% %.% % % %.% % % #.% % % %.#.#.#.%.% %.% % % %.% %.#.#.#.&.% %.% % % %.% #.% % % #.% %.#.#.#.%.% %.% % % % % %.#.#.#.%.% %.% % % %.% %.#.#.#.%.% % % %.% % % &.#.#.#.#.% % #.#.#.% % #.% % % #.% %.% % % #.% %.#.#.#.%.% %.#.#.#.%.% ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
-"% % ........% % % +.+.+.+._.% _......... at .% _........._.% _.+.+.+.+._.% _........._.% _......... at .% _........._.% _......... at .% _......... at .% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % % ^.+.+.+.^.% ",
-"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % ^.% ^.% ^.+.% ",
-"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % +.^.% ^.% +.% ",
-"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % +.% ^.% ^.+.% ",
-"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % +.^.% ^.% ^.% ",
-"% _.+.+.+.+._.% % +.+.+.+._.% _........._.% _........._.% _........._.% _........._.% _........._.% % +.+.+.+._.% _........._.% _........._.% % % % % % _.+.+.+.+._.% _.+.+.+.+._.% % % % % _.+.+.+.+._.% _.+.+.+.+._.% % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % ^.+.+.+.^.% % ",
+"% % ........% % % +.+.+.+.$.% $......... at .% $.........$.% $.+.+.+.+.$.% $.........$.% $......... at .% $.........$.% $......... at .% $......... at .% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % % #.+.+.+.#.% ",
+"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % #.% #.% #.+.% ",
+"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % +.#.% #.% +.% ",
+"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % +.% #.% #.+.% ",
+"% ..% % % % ..% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% ..% % % % +.% ..% % % % +.% +.% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % +.#.% #.% #.% ",
+"% $.+.+.+.+.$.% % +.+.+.+.$.% $.........$.% $.........$.% $.........$.% $.........$.% $.........$.% % +.+.+.+.$.% $.........$.% $.........$.% % % % % % $.+.+.+.+.$.% $.+.+.+.+.$.% % % % % $.+.+.+.+.$.% $.+.+.+.+.$.% % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % #.+.+.+.#.% % ",
"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % +.% % % % +.% ",
-"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % ^.^.^.^.^.+.% ",
-"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % ^.% % % ^.^.% ",
-"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % ^.% % % ^.^.% ",
-"% % ........% % % +.+.+.+._.% _........._.% _........._.% % +.+.+.+._.% _........._.% _........._.% % +.+.+.+._.% _........._.% _........._.% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % ^.^.^.^.^.% % ",
+"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % % % % +.% % % % +.% +.% % % % +.% % #.#.#.#.#.+.% ",
+"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % #.% % % #.#.% ",
+"% ..% % % % ..% +.% % % % ..% ..% % % % +.% +.% % % % ..% +.% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% ..% % % % ..% +.% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % +.% % % % +.% +.% % % % +.% % +.% % +.% % % % +.% +.% % % % +.% % #.% % % #.#.% ",
+"% % ........% % % +.+.+.+.$.% $.........$.% $.........$.% % +.+.+.+.$.% $.........$.% $.........$.% % +.+.+.+.$.% $.........$.% $.........$.% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % +.+.+.+.% % % +.+.+.+.% % % % % % % +.+.+.+.% % % +.+.+.+.% % % #.#.#.#.#.% % ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % "};
diff --git a/master_low.xpm b/master_low.xpm
index 2156b41..03ca81d 100644
--- a/master_low.xpm
+++ b/master_low.xpm
@@ -1,6 +1,6 @@
/* XPM */
-static char * master_xpm[] = {
-"157 88 20 1",
+static char * master_low_xpm[] = {
+"157 88 18 1",
" c None",
". c #000000",
"+ c #FF0000",
@@ -14,13 +14,11 @@ static char * master_xpm[] = {
"- c #20B2AE",
"; c #004941",
"> c #188A86",
-", c #D0D2D1",
-"' c #FEFFFF",
-") c #4F5354",
-"! c #22B2AE",
-"~ c #027E72",
-"{ c #034A40",
-"] c #107D79",
+", c #22B2AE",
+"' c #C7C7C7",
+") c #107D79",
+"! c #027E72",
+"~ c #034A40",
" . ++++ at ++++@++++@####@####@####@####@$$$$@$$$$@$$$$@$$$$ ",
" . ++++ at ++++@++++@####@####@####@####@$$$$@$$$$@$$$$@$$$$ ",
" . ++++ at ++++@++++@####@####@####@####@$$$$@$$$$@$$$$@$$$$ ",
@@ -51,61 +49,61 @@ static char * master_xpm[] = {
" . @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ",
" . @@---@@@;;;>@>--->@>--->@>;;;>@>--->@>--->@>--->@>--->@>--->@@-@@@@@@@ ",
" ..................................... ................= . @-@@@-@;@@@-@;@@@-@;@@@- 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 -@@@- 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 -@@@@;@-@@@@;@;@@@@- 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 --git a/wmacpi.c b/wmacpi-ng.c
similarity index 64%
rename from wmacpi.c
rename to wmacpi-ng.c
index 36bc574..4d968dd 100644
--- a/wmacpi.c
+++ b/wmacpi-ng.c
@@ -13,14 +13,9 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/* #define RETARDED_APM */
-/* #define STUPID_APM */
-/* see README if you need to #define these or not. No user serviceable
- * parts below */
-
#define _GNU_SOURCE
#include <stdio.h>
@@ -37,11 +32,10 @@
#include <X11/extensions/shape.h>
#include <X11/xpm.h>
-#include "wmacpi.h"
+#include "libacpi.h"
+#include "wmacpi-ng.h"
-#if defined(ACPI) && defined(APM)
-# error Cannot compile with ACPI and APM compiled in. Please select only one.
-#endif
+#define WMACPI_NG_VER "0.50"
/* main pixmap */
#ifdef LOW_COLOR
@@ -85,9 +79,7 @@ static void redraw_window(void);
static void render_text(char *string);
static void scroll_text(int x, int y, int width, int tw, int reset);
static void display_percentage(int percent);
-static void display_state(void);
static void display_time(int minutes);
-static void blink_button(Mode mode);
#define copy_xpm_area(x, y, w, h, dx, dy) \
{ \
@@ -96,10 +88,34 @@ static void blink_button(Mode mode);
dockapp->update = 1; \
}
+/* display AC power symbol */
+static void display_power_glyph(void)
+{
+ copy_xpm_area(67, 38, 12, 7, 6, 17);
+}
+
+/* get rid of AC power symbol */
+static void kill_power_glyph(void)
+{
+ copy_xpm_area(67, 48, 12, 7, 6, 17);
+}
+
+/* display battery symbol */
+static void display_battery_glyph(void)
+{
+ copy_xpm_area(82, 38, 12, 7, 20, 17);
+}
+
+/* get rid of battery symbol */
+static void kill_battery_glyph(void)
+{
+ copy_xpm_area(82, 48, 12, 7, 20, 17);
+}
+
static void redraw_window(void)
{
if (dockapp->update) {
- eprint(1, "redrawing window");
+ eprint(0, "redrawing window");
XCopyArea(dockapp->display, dockapp->pixmap, dockapp->iconwin,
dockapp->gc, 0, 0, 64, 64, 0, 0);
XCopyArea(dockapp->display, dockapp->pixmap, dockapp->win,
@@ -203,7 +219,7 @@ static void render_text(char *string)
if (strlen(string) > 53)
return;
- eprint(1, "rendering: %s", string);
+ eprint(0, "rendering: %s", string);
/* prepare the text area by clearing it */
for (i = 0; i < 54; i++) {
@@ -277,8 +293,6 @@ static void scroll_text(int x, int y, int width, int tw, int reset)
}
pos -= 2;
- eprint(0, "scrolling");
-
if (pos > 0) {
copy_xpm_area(66, 9, pos, 7, x, y); /* clear */
XCopyArea(dockapp->display, dockapp->text, dockapp->pixmap,
@@ -292,10 +306,11 @@ static void scroll_text(int x, int y, int width, int tw, int reset)
static void display_percentage(int percent)
{
- static int op = -1, obar;
+ static int op = -1;
+ static unsigned int obar;
unsigned int bar;
- eprint(1, "received: %d\n", percent);
+ eprint(0, "received: %d\n", percent);
if (op == percent)
return;
@@ -365,107 +380,168 @@ static void display_time(int minutes)
omin = min;
}
-static void display_state(void)
+/*
+ * The reworked state handling stuff.
+ */
+
+/* set the current state of the power panel */
+enum panel_states {
+ PS_AC,
+ PS_BATT,
+ PS_NULL,
+};
+
+static void set_power_panel(void)
{
- static int dopower;
- static int docharging;
- static int dobattery;
- static int docritical;
- static int counter;
-
- switch (apminfo->power) {
- case POWER:
- eprint(0, "selected ac power case");
- if (!dopower) {
- dopower = 1;
- docharging = 0;
- dobattery = 0;
- dockapp->blink = OFF;
- copy_xpm_area(67, 38, 12, 7, 6, 17);
- copy_xpm_area(82, 48, 11, 7, 20, 17);
- render_text("On AC power");
+ enum panel_states power = PS_NULL;
+ static int counter = 0;
+ battery *binfo = apminfo->binfo;
+
+ if (apminfo->power == AC) {
+ if (power != PS_AC) {
+ power = PS_AC;
+ kill_battery_glyph();
+ display_power_glyph();
}
- break;
- case CHARGING:
- eprint(0, "selected charging case");
- counter++;
- if (counter == 10) {
- copy_xpm_area(67, 38, 12, 7, 6, 17);
- } else if (counter == 20) {
- copy_xpm_area(67, 48, 12, 7, 6, 17);
+ } else if (apminfo->power == BATT) {
+ if (power != PS_BATT) {
+ power = PS_BATT;
+ kill_power_glyph();
+ display_battery_glyph();
}
- if (counter > 20)
+ }
+
+ if (binfo->charging) {
+ if (counter == 10)
+ display_power_glyph();
+ else if (counter == 20)
+ kill_power_glyph();
+ else if (counter > 30)
+ counter = 0;
+ counter++;
+ }
+
+ if (binfo->capacity_state == CRITICAL) {
+ if (counter == 10)
+ display_battery_glyph();
+ else if (counter == 20)
+ kill_battery_glyph();
+ else if (counter > 30)
counter = 0;
- if (!docharging) {
- render_text("Battery is charging");
- /* get rid of battery symbol */
- copy_xpm_area(82, 48, 12, 7, 20, 17);
- /* housekeeping */
- dockapp->blink = OFF;
- docharging = 1;
- dopower = 0;
- dobattery = 0;
+ counter++;
+ }
+}
+
+/*
+ * The message that needs to be displayed needs to be decided
+ * according to a heirarchy: a message like not present needs to take
+ * precedence over a global thing like the current power status, and
+ * something like a low battery warning should take precedence over
+ * the "on battery" message. Likewise, a battery charging message
+ * needs to take precedence over the on ac power message. The other
+ * question is how much of a precedence local messages should take
+ * over global ones . . .
+ *
+ * So, there are three possible sets of messages: not present, on-line
+ * and off-line messages. We need to decide which of those sets is
+ * appropriate right now, and then decide within them.
+ */
+enum messages {
+ M_NP, /* not present */
+ M_AC, /* on ac power */
+ M_CH, /* battery charging */
+ M_BATT, /* on battery */
+ M_LB, /* low battery */
+ M_CB, /* critical low battery */
+ M_NULL, /* empty starting state */
+};
+
+static void set_message(void)
+{
+ static enum messages state = M_NULL;
+ battery *binfo = apminfo->binfo;
+
+ /* battery not present case */
+ if (!binfo->present) {
+ if (state != M_NP) {
+ state = M_NP;
+ render_text("not present");
}
- break;
- case HIGH:
- case LOW:
- case CRIT:
- eprint(0, "selected battery case");
- if (!dobattery) {
- render_text("On Battery");
- /* display battery symbol */
- copy_xpm_area(82, 38, 12, 7, 20, 17);
- /* get rid of AC power symbol */
- copy_xpm_area(67, 48, 12, 7, 6, 17);
- dobattery = 1;
- dopower = 0;
- docharging = 0;
+ } else if (apminfo->power == AC) {
+ if (binfo->charging) {
+ if (state != M_CH) {
+ state = M_CH;
+ render_text("battery charging");
+ }
+ } else {
+ if (state != M_AC) {
+ state = M_AC;
+ render_text("on ac power");
+ }
}
- if (apminfo->power == CRIT) {
- dockapp->blink = BLINK;
- if (!docritical) {
- render_text("Battery Critical Low");
- docritical = 1;
+ } else {
+ if (binfo->state == CRIT) {
+ if (state != M_CB) {
+ state = M_CB;
+ render_text("critical low battery");
+ }
+ } else if (binfo->state == LOW) {
+ if (state != M_LB) {
+ state = M_LB;
+ render_text("low battery");
}
} else {
- if (docritical) {
- render_text("On Battery");
- docritical = 0;
+ if (state != M_BATT) {
+ state = M_BATT;
+ render_text("on battery");
}
- dockapp->blink = OFF;
}
- break;
- }
+ }
}
-static void blink_button(Mode mode)
+/*
+ * This should really be fixed so that it can handle more than two batteries.
+ */
+
+void set_id_1(void)
{
- static int counter;
- static int clear;
+ copy_xpm_area(118, 38, 15, 15, 44, 30);
+}
- if ((mode == OFF) && !clear) {
- eprint(0, "we are off");
- copy_xpm_area(136, 38, 3, 3, 44, 30);
- clear = 1;
- return;
- }
- if (mode != BLINK)
- return;
+void set_id_2(void)
+{
+ copy_xpm_area(136, 38, 15, 15, 44, 30);
+}
- counter++;
-
- if (counter == 5) {
- copy_xpm_area(137, 33, 3, 3, 44, 30);
- clear = 0;
- } else if (counter == 10) {
- copy_xpm_area(136, 38, 3, 3, 44, 30);
- clear = 0;
- /* make some noise */
- if (noisy_critical)
- XBell(dockapp->display, 100);
+void set_batt_id_area(int bno)
+{
+ switch(bno) {
+ case 0:
+ set_id_1();
+ break;
+ case 1:
+ set_id_2();
+ break;
}
- if (counter > 10)
- counter = 0;
+}
+
+void usage(char *name)
+{
+ printf("%s - help\t\t[timecop at japan.co.jp]\n\n"
+ "-d display\t\tdisplay on remote display <display>\n"
+ "-b\t\t\tmake noise when battery is critical low (beep)\n"
+ "-c value\t\tset critical low alarm at <value> percent\n"
+ "\t\t\t(default: 10 percent)\n"
+ "-m <battery number>\tbattery number to monitor\n"
+ "-v\t\t\tincrease verbosity.\n"
+ "-h\t\t\tdisplay this help\n",
+ name);
+}
+
+void print_version(void)
+{
+ printf("wmacpi-ng version %s\n", WMACPI_NG_VER);
+ printf(" Using libacpi version %s\n", LIBACPI_VER);
}
int main(int argc, char **argv)
@@ -473,21 +549,22 @@ int main(int argc, char **argv)
char *display = NULL;
char ch;
int update = 0;
+ battery *binfo;
dockapp = calloc(1, sizeof(Dockapp));
apminfo = calloc(1, sizeof(APMInfo));
dockapp->blink = OFF;
apminfo->crit_level = 10;
+ battery_no = 1;
/* see if whatever we want to use is supported */
- if (power_init()) {
+ if (power_init())
/* power_init functions handle printing error messages */
exit(1);
- }
/* parse command-line options */
- while ((ch = getopt(argc, argv, "bd:c:h")) != EOF) {
+ while ((ch = getopt(argc, argv, "bd:c:m:hvV")) != EOF) {
switch (ch) {
case 'b':
noisy_critical = 1;
@@ -506,18 +583,38 @@ int main(int argc, char **argv)
if (optarg)
display = strdup(optarg);
break;
+ case 'm':
+ if (optarg) {
+ battery_no = atoi(optarg);
+ if (battery_no >= MAXBATT) {
+ fprintf(stderr, "Please specify a battery number below %d\n",
+ MAXBATT);
+ return 1;
+ }
+ if (battery_no > batt_count) {
+ fprintf(stderr, "Battery %d does not appear to be installed\n",
+ battery_no);
+ return 1;
+ }
+ fprintf(stderr, "Monitoring battery %d\n", battery_no);
+ }
+ break;
case 'h':
- printf("wmacpi - help\t\t[timecop at japan.co.jp]\n\n"
- "-d display\t\tdisplay on remote display <display>\n"
- "-b\t\t\tmake noise when battery is critical low (beep)\n"
- "-c value\t\tset critical low alarm at <value> percent\n"
- "\t\t\t(default: 10 percent)\n"
- "-h\t\t\tdisplay this help\n");
+ usage(argv[0]);
return 0;
+ case 'v':
+ verbosity++;
break;
+ case 'V':
+ print_version();
+ return 0;
+ default:
+ usage(argv[0]);
+ return 1;
}
}
+ battery_no--;
/* open local or command-line specified display */
if (open_display(display))
@@ -527,8 +624,11 @@ int main(int argc, char **argv)
new_window("apm");
/* get initial statistics */
- acquire_info();
-
+ acquire_all_info();
+ binfo = &batteries[battery_no];
+ apminfo->binfo = binfo;
+ fprintf(stderr, "monitoring battery %s\n", binfo->name);
+ set_batt_id_area(battery_no);
dockapp->dspmode = REMAIN;
/* main loop */
@@ -549,40 +649,22 @@ int main(int argc, char **argv)
exit(0);
break;
case ButtonPress:
- /* press event */
- if (event.xbutton.x >= 44 && event.xbutton.x <= 57 &&
- event.xbutton.y >= 30 && event.xbutton.y <= 43) {
- eprint(0, "inside button!");
- dockapp->pressed = 1;
- copy_xpm_area(118, 38, 15, 15, 44, 30);
- }
break;
case ButtonRelease:
- /* release event */
- if (event.xbutton.x >= 44 && event.xbutton.x <= 57 &&
- event.xbutton.y >= 30 && event.xbutton.y <= 43 &&
- dockapp->pressed) {
- /* handle button press */
- eprint(0, "release still inside button!");
- dockapp->pressed = 0;
- copy_xpm_area(136, 38, 15, 15, 44, 30);
- if ((apminfo->power != POWER) && (apminfo->power != CHARGING)) {
- dockapp->dspmode = !dockapp->dspmode;
- eprint(1, "Mode: %d", dockapp->dspmode);
- }
- /* end button press handler */
- }
- if (dockapp->pressed) {
- copy_xpm_area(136, 38, 15, 15, 44, 30);
- dockapp->pressed = 0;
- }
+ /* cycle through the known batteries. */
+ battery_no++;
+ battery_no = battery_no % batt_count;
+ apminfo->binfo = &batteries[battery_no];
+ binfo = apminfo->binfo;
+ fprintf(stderr, "changing to monitor battery %d\n", battery_no + 1);
+ set_batt_id_area(battery_no);
break;
}
}
if (update++ == 30) {
- eprint(1, "polling apm");
- acquire_info();
+ eprint(0, "polling apm");
+ acquire_all_info();
update = 0;
}
@@ -591,18 +673,24 @@ int main(int argc, char **argv)
count = 0;
}
- /* it's okay to test here because display_time will not draw anything
- * unless there is a change. Also if we switched power states from
- * battery to charging/etc, we need to exit from "timer" mode */
- if (dockapp->dspmode == REMAIN || apminfo->power == POWER || apminfo->power == CHARGING) {
+ /* the old code had some kind of weird crap with timers and the like.
+ * As far as I can tell, it's meaningless - the time we want to display
+ * is the time calculated from the remaining capacity, as per the
+ * ACPI spec. The only thing I'd change is the handling of a charging
+ * state: my best guess, based on the behaviour I'm seeing with my
+ * Lifebook, is that the present rate value when charging is the rate
+ * at which the batteries are being charged, which would mean I'd just
+ * need to reverse the rtime calculation to be able to work out how
+ * much time remained until the batteries were fully charged . . .
+ * That would be rather useful, though given it would vary rather a lot
+ * it seems likely that it'd be little more than a rough guesstimate. */
+ if (binfo->charging)
+ display_time(binfo->charge_time);
+ else
display_time(apminfo->rtime);
- } else {
- display_time((time(NULL) - apminfo->timer) / 60);
- }
-
- display_state();
- blink_button(dockapp->blink);
- display_percentage(apminfo->percentage);
+ set_power_panel();
+ set_message();
+ display_percentage(binfo->percentage);
scroll_text(6, 50, 52, dockapp->tw, 0);
/* redraw_window, if anything changed - determined inside
@@ -612,23 +700,3 @@ int main(int argc, char **argv)
}
return 0;
}
-
-/* this handles enabling "on-battery" timer. It only needs to happen once
- * for each unplug event. Functions from libapm and libacpi call this to
- * start the timer */
-void process_plugin_timer(void)
-{
- static int timer;
-
- if ((apminfo->power != POWER) && (apminfo->power != CHARGING) && !timer) {
- eprint(1, "not AC and not charging, and timer is not started");
- eprint(1, "starting battery timer");
- apminfo->timer = time(NULL);
- timer = 1;
- }
- if (((apminfo->power == POWER) || (apminfo->power == CHARGING)) && timer) {
- eprint(1, "disabling battery timer");
- timer = 0;
- }
-
-}
diff --git a/wmacpi-ng.h b/wmacpi-ng.h
new file mode 100644
index 0000000..a49acdf
--- /dev/null
+++ b/wmacpi-ng.h
@@ -0,0 +1,9 @@
+#ifndef _WMACPI_H_
+#define _WMACPI_H_
+
+#include "libacpi.h"
+
+/* we need to make these available generally. */
+int battery_no;
+
+#endif /* _WMACPI_H_ */
diff --git a/wmacpi.h b/wmacpi.h
deleted file mode 100644
index e9c15a5..0000000
--- a/wmacpi.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _WMACPI_H_
-#define _WMACPI_H_
-
-#ifdef PRO
-#define eprint(level, fmt, arg...) \
- switch (level) { \
- case 0: \
- break; \
- case 1: \
- fprintf(stderr, __FUNCTION__": " fmt, ##arg); \
- fprintf(stderr, "\n"); \
- break; \
- }
-#else
-#define eprint(level, fmt, arg...) \
- do { } while (0)
-#endif
-
-typedef enum {
- REMAIN,
- TIMER
-} DspMode;
-
-typedef enum {
- BLINK,
- OFF
-} Mode;
-
-typedef enum {
- POWER, /* on AC, Battery charged */
- CHARGING, /* on AC, Charging */
- HIGH, /* on Battery, HIGH */
- LOW, /* on Battery, LOW */
- CRIT /* on Battery, CRIT */
-} State;
-
-typedef struct {
- State power; /* power state: Battery levels or AC */
- int percentage; /* battery percentage (-1 if no battery) */
- int rtime; /* remaining time */
- int timer; /* how long been on battery? */
- int crit_level; /* anything below this is critical low */
-} APMInfo;
-
-/* detect plugin events */
-void process_plugin_timer(void);
-/* check if apm/acpi is enabled, etc */
-int power_init(void);
-/* fill APMInfo with data */
-void acquire_info(void);
-
-#endif /* _WMACPI_H_ */
--
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