From
https://ftp.openbsd.org/pub/OpenBSD/distfiles/wmapm-3.1.tar.gz
---
 wmapm/BUGS                            |  13 +
 wmapm/CHANGES                         |  98 ++++
 wmapm/COPYING                         | 339 ++++++++++++
 wmapm/HINTS                           |  39 ++
 wmapm/INSTALL                         |  20 +
 wmapm/README                          |  81 +++
 wmapm/TODO                            |  14 +
 wmapm/wmapm/Makefile                  |  29 +
 wmapm/wmapm/wmapm.1                   |  49 ++
 wmapm/wmapm/wmapm.c                   | 999 ++++++++++++++++++++++++++++++++++
 wmapm/wmapm/wmapm.gif                 | Bin 0 -> 1703 bytes
 wmapm/wmapm/wmapm.h                   |  56 ++
 wmapm/wmapm/wmapm_mask.xbm            |  38 ++
 wmapm/wmapm/wmapm_master.xpm          | 171 ++++++
 wmapm/wmapm/wmapm_master_LowColor.xpm | 137 +++++
 wmapm/wmgeneral/wmgeneral.c           | 366 +++++++++++++
 wmapm/wmgeneral/wmgeneral.h           |  50 ++
 17 files changed, 2499 insertions(+)
 create mode 100644 wmapm/BUGS
 create mode 100644 wmapm/CHANGES
 create mode 100644 wmapm/COPYING
 create mode 100644 wmapm/HINTS
 create mode 100644 wmapm/INSTALL
 create mode 100644 wmapm/README
 create mode 100644 wmapm/TODO
 create mode 100644 wmapm/wmapm/Makefile
 create mode 100644 wmapm/wmapm/wmapm.1
 create mode 100644 wmapm/wmapm/wmapm.c
 create mode 100644 wmapm/wmapm/wmapm.gif
 create mode 100644 wmapm/wmapm/wmapm.h
 create mode 100644 wmapm/wmapm/wmapm_mask.xbm
 create mode 100644 wmapm/wmapm/wmapm_master.xpm
 create mode 100644 wmapm/wmapm/wmapm_master_LowColor.xpm
 create mode 100644 wmapm/wmgeneral/wmgeneral.c
 create mode 100644 wmapm/wmgeneral/wmgeneral.h

diff --git a/wmapm/BUGS b/wmapm/BUGS
new file mode 100644
index 0000000..19dcaac
--- /dev/null
+++ b/wmapm/BUGS
@@ -0,0 +1,13 @@
+None that I know of... :)
+
+Please send bug reports to mghender...@lanl.gov or jed...@fxp.org and
+describe the problem as detailed as you can.
+
+Note: all apm statistics are taken directly from
+/proc/apm (in Linux) or /dev/apm (in FreeBSD).  If 
+you see odd behavior with WMAPM (such as
+displaying battery time remaining without a
+corresponding percentage), please first check the
+statistics in /proc/apm (or using your system's
+'apm' program to see if the computer/kernel are 
+properly reporting the applicable statistics.
diff --git a/wmapm/CHANGES b/wmapm/CHANGES
new file mode 100644
index 0000000..6c37f50
--- /dev/null
+++ b/wmapm/CHANGES
@@ -0,0 +1,98 @@
+WMAPM changes.
+
+      Version                   Description
+---------------------------------------------------------------------------------------------
+   
+       3.1 -Released: Jan 11, 2000.
+                       + Added support for time left on FreeBSD 3.x/4.x
+                         (Chris D. Faulhaber <jed...@fxp.org>)
+                       + Added support for Solaris.  Works well on a SPARCbook 
3GX.
+                         Unsure of any others out there.
+                         William M. Perry <wmpe...@aventail.com>
+
+       3.0     -Released: December 15, 1998.
+                A Major overhaul performed. Changes include;
+  
+                       + Added buttons to place laptop into "Suspend" (button 
labeled `Z') 
+                         or "Standby" (button labeled `S') mode. Buttons are 
separated
+                         by status LEDs to minimize accidentally clicking on 
the wrong
+                         one. I used `Z' for suspend because its like the 
laptop is 
+                         catching some Zs (i.e. going to sleep).
+  
+                       + Replaced the 3 rectangular red/yellow/green status 
indicators
+                         with 3 small round LEDs and moved them to a viewport 
at the 
+                         bottom between the two buttons. This array of LEDs 
could in future
+                         be moved to a single LED in the main viewport to make 
room for
+                         other things at this location (perhaps more buttons 
if apm supports
+                         more things like truning off LCD, etc).
+  
+                       + Created user-definable LowLevel and CriticalLevel 
thresholds. Yellow LED
+                         comes on when Battery Percentage hits the LowLevel 
threshold. Red comes on
+                         when you reach CriticalLevel threshold.
+  
+                       + Made red status LED blink for extra noticability. 
User can define blink rate.
+                         A BlinkRate of 0 turns off blinking.
+  
+                       + Moved all of the other indicators into a single 
viewport above the
+                         buttons and status LEDs.
+  
+                       + Changed the red-dark-green colorbar to a banded blue 
LED bar that is tipped
+                         with a color indicating capacity level. The tip color 
goes through
+                         green-yellow-orange-red. A series of single-pixel 
dots is always present
+                         below the bar to indicate its range. This is needed 
now, because
+                         the bar is free-floating in the viewport. The 
single-pixel dots can be
+                         seen easily on an LCD - the type of monitor wmapm is 
likely to be used.
+  
+                       + Changed the `CHARGING' indicator with a single red 
`C' indicator at the
+                         upper left of the APP.
+  
+                       + Changed percentage indicator so that it can display 
100%. (Used to only go
+                         up to 99% max).
+  
+                       + Changed time indicator to have a +/- sign depending 
on whether you are
+                         charging up or draining down. (+ means you have that 
much battery life
+                         left before its discharged. - means you have that 
much time to wait until
+                         the battery is fully charged.)
+                       
+                       + Fixed a problem with very large "TimeLeft" values. If 
the time is greater 
+                         than the maximum time displayable 99 hours and 59 
minutes, a ---:-- is 
+                         listed instead.  Since the time is based on measured 
charge/discharge rates, 
+                         when the battery is doing neither, the time is 
essentially infinite. On my 
+                         (M Henderson's) laptop, the time left indicated 32766 
when this happened.
+                         FreeBSD systems should also show a ---:-- indicator. 
Dont have FreeBSD though
+                         so I couldnt test it....
+  
+                       + Changed Makefile to suid the apm program. This is 
needed to allow users to
+                         invoke the standby and suspend capabilities in apm.
+  
+                       + Sped up the loop to catch button press and expose 
events. But the querying of
+                         /proc/apm is still done about once a second...
+ 
+                        + Added alert feature. User can use command line 
option -A <T1 T2> to turn on alerts
+                          via wall. T1 and T2 are the time in seconds between 
updates for Low and Critical
+                          status. By default the alerts are turned off.
+  
+                       + Various sundry code cleanups.
+  
+   
+       2.0     - Added FreeBSD support.
+   
+       1.3     - Fixed an annoying little problem with the the meter
+                 not properly lowering as the battery is depleted.
+                 Also did some code cleanup, enhanced the Makefile which
+                 now includes 'make install'.
+                 Released 980826
+  
+       1.2     - Fixed bug that showed 100% battery capacity
+                 as 90% (I never noticed since my battery seems
+                 to max out at 98%).
+                 Thanx to Brice Ruth <br...@ltic.com> for pointing out/helping 
fix the
+                 100% bug (err...feature).
+                 Released 980731
+   
+       1.1     - Removed libapm dependency; tweaked some code.
+                 Released 980729
+  
+       1.0     - Initial release version.
+                 Released 980725
+  
diff --git a/wmapm/COPYING b/wmapm/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/wmapm/COPYING
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, 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 Library 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
+
+       Appendix: 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) 19yy  <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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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 Library General
+Public License instead of this License.
diff --git a/wmapm/HINTS b/wmapm/HINTS
new file mode 100644
index 0000000..8fc7515
--- /dev/null
+++ b/wmapm/HINTS
@@ -0,0 +1,39 @@
+Hints for WMAPM
+
+Generic
+--------------------------------------------------------------
+WMAPM supports 7 commandline options:
+
+       -h (help); 
+       -C (Critical Percent Threshold);
+       -L (Low Percent Threshold);
+       -b (BlinkRate for red LED);
+       -B (Beep Volume when at critical level);
+       -A <T1 T2>;
+       -display (display);
+
+
+WindowMaker
+--------------------------------------------------------------
+WindowMaker users simply drag and drop the WMAPM dock.app on
+the WindowMaker Dock (preferred) or on the Fiend and select
+'autolaunch' from the rightmouse button popupmenu.
+
+
+Afterstep
+--------------------------------------------------------------
+Afterstep users put the following in their .steprc
+"Wharf wmapm - MaxSwallow "wmapm" wmapm &".
+
+Note: AfterStep's Wharf has a problem with pixmaps that are
+larger than 60x60 pixels. Please tell the AfterStep authors
+to fix this, this is not our fault, but a Wharf problem!
+ 
+
+Other WindowManagers
+--------------------------------------------------------------
+For other windowmanagers, WMAPM runs nicely as a 64x64 shaped
+icon on your desktop.
+
+
+
diff --git a/wmapm/INSTALL b/wmapm/INSTALL
new file mode 100644
index 0000000..93a1782
--- /dev/null
+++ b/wmapm/INSTALL
@@ -0,0 +1,20 @@
+Installation instructions for WMAPM.
+
+Requirements
+--------------------------------------------------------------
+  WMAPM requires the Xpm library (which should be available on
+most machines with XFree86 installed).
+  In order to compile WMAPM using the Makefile, GNU make must
+be used (FreeBSD users, the default BSD 'make' does not work).
+
+Installation
+--------------------------------------------------------------
+1) % tar -zxvf wmapm-3.1.tar.gz
+2) % cd wmapm-3.1/wmapm/
+3) % make (or gmake on most *BSD systems)
+4) % make install (must be root) or simply copy and binary (and
+     optionally the man page) to a directory in your path.
+     (Makefile does an suid on apm; you must be root to do this.)
+5) % wmapm & (or 'wmapm -h' for help, or 'man wmapm' for the man page)
+
+Be sure to read the HINTS and TODO files too!
diff --git a/wmapm/README b/wmapm/README
new file mode 100644
index 0000000..995c8d5
--- /dev/null
+++ b/wmapm/README
@@ -0,0 +1,81 @@
+WMAPM-3.1 release
+--------------------------------------------------------------
+Authors....: wmapm was originally written by Chris D. Faulhaber 
+            <jed...@fxp.org>. Version 3.0 modifications due to
+            Michael G. Henderson <mghender...@lanl.gov>
+               
+Credits...:  Rik Faith <fa...@cs.unc.edu> for his implementation
+             of libapm with respect to Linux APM support.
+             Martijm Pieterse <piete...@xs4all.nl> and
+             Antoine Nulle <w...@xs4all.nl> for a great (and
+             somewhat standardised interface) which I used
+             as a template (wmmon.app and wmgeneral).
+
+Thanx to..:  Brice Ruth <br...@ltic.com> for the corrections
+             pertaining to the 100% bug (err...feature).
+             Timecop <time...@linuxwarez.com> for corrections to
+             fix the meter mismatch.
+            William M. Perry - Added Solaris support.
+            
+Also, thanks to the following for various
+bug fixes, patches and/or suggestions;
+
+            ObiTuarY 
+            MATSUBAYASHI 'Shaolin' Kohji"
+            Fumihiko Nishio
+            
+
+
+  
+Description
+--------------------------------------------------------------
+WMAPM monitors the APM statistics through the APM support in
+the Linux and FreeBSD Kernels.  This information, presented in
+a nice visual format, can be invaluable on laptops (as I have
+found in my recent/continual travels as a Field Engineer for a
+small computer hardware manufacturer).
+
+WMAPM compiles successfully on both 2.0.x and 2.1.1xx kernels
+using libc5 and libc6 (glibc2), and on FreeBSD 3.x-RELEASE/
+FreeBSD-3.x-STABLE.
+
+WMAPM currently provides:
+
+        * Status of power supply (battery or AC);
+        * Percentage of battery remaining (numeric and meter);
+        * Battery charging status;
+       * Time left to battery depletion;
+       * High/Low/Critical battery status (Red/Yellow/Green);
+
+Files
+--------------------------------------------------------------
+README         This file.
+INSTALL                Installation instructions.
+HINTS          Hints about what you can do with WMAPM.
+BUGS           Things you don't want to know ;-)
+CHANGES        Description of changes.
+COPYING                GNU General Public License Version 2.
+TODO           Stuff I've planned for future WMAPM releases.
+       
+
+Bugs
+--------------------------------------------------------------
+If you discover any bugs in this software, please send a 
+bugreport to jed...@fxp.org and describe the problem as
+as detailed as you can.
+
+
+Copyright
+--------------------------------------------------------------
+WMAPM.app is copyright (c)1998,1999 by Chris D. Faulhaber and
+licensed through the GNU General Public License. Read the 
+COPYING file for the complete GNU license.
+
+
+Other
+--------------------------------------------------------------
+You are free to distribute this application per the GNU
+General Public License; however, if this package is
+distributed (through source and/or binary) in a larger
+package (e.g. Linux distribution), I would appreciate a copy
+(mostly to gloat as to where my apps have been distributed :).
diff --git a/wmapm/TODO b/wmapm/TODO
new file mode 100644
index 0000000..09e1faf
--- /dev/null
+++ b/wmapm/TODO
@@ -0,0 +1,14 @@
+TODO list for WMAPM
+--------------------------------------------------------------
+
+       * Work on NetBSD support.
+       * Add GUI to allow user to set things.
+       * Add ~/.wmapmrc file to store saved settings.
+         
+Your feedback is greatly appreciated! If you have nice
+suggestions, ideas, whatever, that aren't on this list, feel 
+free to mail them to:
+
+               jed...@fxp.org
+
+If you don't let me know... how am I suppose to know? ;-)
diff --git a/wmapm/wmapm/Makefile b/wmapm/wmapm/Makefile
new file mode 100644
index 0000000..8ccea80
--- /dev/null
+++ b/wmapm/wmapm/Makefile
@@ -0,0 +1,29 @@
+CC     = gcc
+CFLAGS = -O2 -Wall
+INCDIR = -I/usr/X11R6/include
+DESTDIR= /usr/X11R6
+LIBDIR = -L/usr/X11R6/lib
+LIBS   = -lXpm -lX11 -lXext
+OBJS   = wmapm.o \
+         ../wmgeneral/wmgeneral.o
+
+.c.o:
+       $(CC) $(COPTS) -D$(shell echo `uname -s`) -c $< -o $*.o $(INCDIR)
+
+all:   wmapm.o wmapm
+
+wmapm.o: wmapm_master.xpm wmapm_mask.xbm wmapm.h
+wmapm: $(OBJS)
+       $(CC) $(COPTS) $(SYSTEM) -o wmapm $^ $(INCDIR) $(LIBDIR) $(LIBS)
+
+clean:
+       for i in $(OBJS) ; do \
+               rm -f $$i; \
+       done
+       rm -f wmapm
+
+install:: wmapm
+       install -s -m 0755 wmapm $(DESTDIR)/bin
+       install    -m 0644 wmapm.1 $(DESTDIR)/man/man1 
+       chmod +s $(DESTDIR)/bin/wmapm
+
diff --git a/wmapm/wmapm/wmapm.1 b/wmapm/wmapm/wmapm.1
new file mode 100644
index 0000000..5dfe7f0
--- /dev/null
+++ b/wmapm/wmapm/wmapm.1
@@ -0,0 +1,49 @@
+.TH WMAPM 1 "15 December 1998" 
+.SH NAME
+WMAPM \- Dockable APM/Battery Monitor
+.SH SYNOPSIS
+.B wmapm
+[-h] [-display display] [-C CriticalLevel] [-L LowLevel] [-b BlinkRate] [-B 
BeepVolume] [-A T1 T2]
+.SH DESCRIPTION
+.PP
+WMAPM is an APM/Battery Monitor.  It is used to visually display and
+interpret details of APM/Battery status from the system's BIOS via
+Linux and FreeBSD kernels.
+.PP
+WMAPM is dockable using WindowMaker and AfterStep window-managers;
+under other window-managers, WMAPM appears as a nicely-sized 64x64
+application.
+.PP
+WMAPM provides the following information: battery or AC operation, battery
+life remaining (both in percentage and bar), time left until
+battery-depletion (Linux only), charging status, and battery status 
+(high - green, low - yellow, or critical - red) as reported by the
+the APM BIOS.
+.SH OPTIONS
+.TP
+.B \-h
+Display list of command-line options.
+.TP
+.B \-C CriticalPercent
+Set Critical threshold to specified (integer) percent.
+.TP
+.B \-L LowPercent
+Set Low threshold to specified (integer) percent.
+.TP
+.B \-b BlinkRate
+Set blink rate of red LED to given (float) value.
+.TP
+.B \-B BeepVolume
+Make wmapm beep at the specified volume (integer between -100 and 100) when 
critical level is reached.
+.TP
+.B \-A Time1 Time2
+Make wmapm warn all users via wall of Low and Critical status. Time1 and Time2 
are times in seconds between updates
+when in Low and Critical States respectively.
+.TP
+.B \-display [display]
+Use the designated X display.
+.SH BUGS
+None are known
+.SH AUTHORS
+Chris D. Faulhaber <jed...@speck.ml.org>
+Michael G. Henderson <mghender...@lanl.gov>
diff --git a/wmapm/wmapm/wmapm.c b/wmapm/wmapm/wmapm.c
new file mode 100644
index 0000000..70f6880
--- /dev/null
+++ b/wmapm/wmapm/wmapm.c
@@ -0,0 +1,999 @@
+/*
+ *     wmapm-3.1
+ *
+ *             A WindowMaker dockable application that allows laptop users
+ *             to graphically monitor the status of their power source. 
+ *             (I.e. whether or not AC or battery is in use as well as
+ *              how long it will take to drain or charge the battery.)
+ *
+ *              Originally written (and copyrighted under GPL) by
+ *             Chris D. Faulhaber <jed...@fxp.org>. Version 3.0
+ *             is an extensively modified version of version 2.0 
+ *             by Michael G. Henderson <mghender...@lanl.gov>.
+ *
+ *
+ *     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, 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 (see the file COPYING); if not, write to the
+ *     Free Software Foundation, Inc.,
+ *     59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ *
+ *     Portions of code derived from:
+ *             apm/apmd/libapm : (c) 1996 Rickard E. Faith (r.fa...@ieee.org)
+ *             wmmon           : (c) 1998 Martijn Pieterse 
(piete...@xs4all.nl) and
+ *                              Antoine Nulle (w...@xs4all.nl) 
+ *
+ *     Thanx to Timecop <time...@linuxwarez.com> for pointing out/helping to
+ *     Toggle fix the meter mismatch.
+ *
+ */
+
+
+
+/*
+ *     Changes:
+ *
+ *  3.1                -Released: June 1, 1999.
+ *                     + Added support for time left on FreeBSD 3.x/4.x
+ *                       (Chris D. Faulhaber <jed...@fxp.org>)
+ *
+ *
+ *     3.01    -Released: January 3, 1999.
+ *
+ *                     + Added a LowColor Pixmap for the poor saps using 8-bit 
displays
+ *                       on laptops. There are a *lot* of laptops out there 
that are only
+ *                       8-bit. Use the "-l" command-line option to invoke.
+ *
+ * 
+ *     3.0     -Released: December 15, 1998.
+ *              A Major overhaul performed. Changes include;
+ *
+ *                     + Added buttons to place laptop into "Suspend" (button 
labeled `Z') 
+ *                       or "Standby" (button labeled `S') mode. Buttons are 
separated
+ *                       by status LEDs to minimize accidentally clicking on 
the wrong
+ *                       one. I used `Z' for suspend because its like the 
laptop is 
+ *                       catching some Zs (i.e. going to sleep).
+ *
+ *                     + Replaced the 3 rectangular red/yellow/green status 
indicators
+ *                       with 3 small round LEDs and moved them to a viewport 
at the 
+ *                       bottom between the two buttons. This array of LEDs 
could in future
+ *                       be moved to a single LED in the main viewport to make 
room for
+ *                       other things at this location (perhaps more buttons 
if apm supports
+ *                       more things like truning off LCD, etc).
+ *
+ *                     + Created user-definable LowLevel and CriticalLevel 
thresholds. Yellow LED
+ *                       comes on when Battery Percentage hits the LowLevel 
threshold. Red comes on
+ *                       when you reach CriticalLevel threshold.
+ *
+ *                     + Made red status LED blink for extra noticability. 
User can define blink rate.
+ *                       A BlinkRate of 0 turns off blinking.
+ *
+ *                     + Moved all of the other indicators into a single 
viewport above the
+ *                       buttons and status LEDs.
+ *
+ *                     + Changed the red-dark-green colorbar to a banded blue 
LED bar that is tipped
+ *                       with a color indicating capacity level. The tip color 
goes through
+ *                       green-yellow-orange-red. A series of single-pixel 
dots is always present
+ *                       below the bar to indicate its range. This is needed 
now, because
+ *                       the bar is free-floating in the viewport. The 
single-pixel dots can be
+ *                       seen easily on an LCD - the type of monitor wmapm is 
likely to be used.
+ *
+ *                     + Changed the `CHARGING' indicator with a single red 
`C' indicator at the
+ *                       upper left of the APP.
+ *
+ *                     + Changed percentage indicator so that it can display 
100%. (Used to only go
+ *                       up to 99% max).
+ *
+ *                     + Changed time indicator to have a +/- sign depending 
on whether you are
+ *                       charging up or draining down. (+ means you have that 
much battery life
+ *                       left before its discharged. - means you have that 
much time to wait until
+ *                       the battery is fully charged.)
+ *                     
+ *                     + Fixed a problem with very large "TimeLeft" values. If 
the time is greater 
+ *                       than the maximum time displayable 99 hours and 59 
minutes, a ---:-- is 
+ *                       listed instead.  Since the time is based on measured 
charge/discharge rates, 
+ *                       when the battery is doing neither, the time is 
essentially infinite. On my 
+ *                       (M Henderson's) laptop, the time left indicated 32766 
when this happened.
+ *                       FreeBSD systems should also show a ---:-- indicator. 
Dont have FreeBSD though
+ *                       so I couldnt test it....
+ *
+ *                     + Changed Makefile to suid the apm program. This is 
needed to allow users to
+ *                       invoke the standby and suspend capabilities in apm.
+ *
+ *                     + Sped up the loop to catch button press and expose 
events. But the querying of
+ *                       /proc/apm is still done about once a second...
+ *
+ *                     + Added alert feature. User can use command line option 
-A <T1 T2> to turn on alerts
+ *                       via wall. T1 and T2 are the time in seconds between 
updates for Low and Critical
+ *                       status. By default the alerts are turned off.
+ *
+ *                     + Various sundry code cleanups.
+ *
+ * 
+ *     2.0     - Added FreeBSD support.
+ * 
+ *     1.3     - Fixed an annoying little problem with the the meter
+ *               not properly lowering as the battery is depleted.
+ *               Also did some code cleanup, enhanced the Makefile which
+ *               now includes 'make install'.
+ *               Released 980826
+ *
+ *     1.2     - Fixed bug that showed 100% battery capacity
+ *               as 90% (I never noticed since my battery seems
+ *               to max out at 98%).
+ *               Thanx to Brice Ruth <br...@ltic.com> for pointing out/helping 
fix the
+ *               100% bug (err...feature).
+ *               Released 980731
+ * 
+ *     1.1     - Removed libapm dependency; tweaked some code.
+ *               Released 980729
+ *
+ *     1.0     - Initial release version.
+ *               Released 980725
+ *
+ */
+
+
+#ifdef SunOS
+#include <unistd.h>
+#include <fcntl.h>
+#include <stropts.h>
+#include <sys/battery.h>
+#endif
+
+
+#ifdef FreeBSD
+#include <err.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <machine/apm_bios.h>
+#endif 
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/X.h>
+#include <X11/xpm.h>
+#include "wmapm.h"
+#include "../wmgeneral/wmgeneral.h"
+#include "wmapm_master.xpm"
+#include "wmapm_master_LowColor.xpm"
+#include "wmapm_mask.xbm"
+
+
+
+#ifdef Linux
+int apm_read(struct my_apm_info *i);
+#else
+# ifdef FreeBSD
+int apm_read(apm_info_t temp_info);
+# endif
+#endif
+int apm_exists();
+void ParseCMDLine(int argc, char *argv[]);
+void pressEvent(XButtonEvent *xev);
+
+
+
+
+int    CriticalLevel           = 10;
+int    LowLevel                = 40;
+float   BlinkRate              = 3.0;   /* blinks per second */
+float   UpdateRate             = 0.8;   /* Number of updates per second */
+int    Beep                    = 0;     /* Controls beeping when you get to 
CriticalLevel: Off by default */
+int    Volume                  = 50;    /* ring bell at 50% volume */
+int    Alert                   = 0;     /* Controls whether alert is sent to 
all users via wall: Off by default  */
+int    UseLowColorPixmap       = 0;     /* Use a lower number of colors for 
the poor saps on 8-bit displays -- common
+                                           on laptops! */
+float          LAlertRate              = 300.0; /* send alert every 5 minutes 
when Low */
+float          CAlertRate              = 120.0; /* send alert every 2 minutes 
when Critical */
+
+
+
+
+
+
+
+
+/*  
+ *   main  
+ */
+int main(int argc, char *argv[]) {
+
+
+    struct my_apm_info         my_cur_info;
+    int                        time_left, 
+                       hour_left, 
+                       min_left, 
+                       digit;
+#ifdef FreeBSD
+    struct apm_info    temp_info;
+#endif
+    XEvent             event;
+    int                        m, mMax, n, nMax, k, Toggle;
+    long int           r, rMax, s, sMax;
+    FILE               *fp;
+
+
+
+
+
+
+
+    BlinkRate = 3.0;
+    UpdateRate = 1.0/1.25;
+
+
+
+  
+    /*
+     *  Parse any command line arguments.
+     */
+    ParseCMDLine(argc, argv);
+
+    BlinkRate = (BlinkRate >= 0.0) ? BlinkRate : -1.0*BlinkRate;
+    UpdateRate = (UpdateRate >= 0.0) ? UpdateRate : -1.0*UpdateRate;
+   
+
+    nMax = (int)( 1.0e6/(2.0*UpdateRate*DELAY)  );
+    mMax = (BlinkRate > 0.0) ? (int)( 1.0e6/(2.0*BlinkRate*DELAY)  ) : nMax;
+    rMax = (int)( LAlertRate*1.0e6/(2.0*DELAY)  );
+    sMax = (int)( CAlertRate*1.0e6/(2.0*DELAY)  );
+
+
+
+
+
+
+
+
+
+    /*  
+     *  Check for APM support 
+     */   
+    if (!apm_exists()) {
+#ifdef Linux
+        fprintf(stderr, "No APM support in kernel\n");
+#else
+        fprintf(stderr, "Unable to access APM info\n");
+#endif
+        exit(1);
+    }
+
+
+
+   
+    if (UseLowColorPixmap)
+        openXwindow(argc, argv, wmapm_master_LowColor, wmapm_mask_bits, 
wmapm_mask_width, wmapm_mask_height);
+    else
+        openXwindow(argc, argv, wmapm_master, wmapm_mask_bits, 
wmapm_mask_width, wmapm_mask_height);
+
+
+
+   
+    /*
+     *     Loop until we die...
+     */
+    n = 32000;
+    m = 32000;
+    r = rMax+1;
+    s = sMax+1;
+    while(1) {
+
+
+       /*
+        *  Only process apm info only every nMax cycles of this
+        *  loop. We run it faster to catch the xevents like button 
+        *  presses and expose events, etc...
+        *  
+        *  DELAY is set at 0.00625 seconds, so process apm info
+        *  every 1.25 seconds...
+        *
+        */
+       if (n>nMax){
+
+           n = 0;
+
+#if defined(Linux) || defined(SunOS)
+           if (apm_read(&my_cur_info)) {
+#else
+# ifdef FreeBSD
+            if (apm_read(&temp_info)) {
+# endif
+#endif
+               fprintf(stderr, "Cannot read APM information: %i\n");
+               exit(1);
+           }
+
+
+#ifdef FreeBSD     /* Convert status's */
+           my_cur_info.ac_line_status     = (int)temp_info.ai_acline;
+           my_cur_info.battery_status     = (int)temp_info.ai_batt_stat;
+           my_cur_info.battery_percentage = (int)temp_info.ai_batt_life;
+           my_cur_info.battery_time       = (int)temp_info.ai_batt_time;
+#endif
+       
+
+
+
+
+
+           /* 
+            *   Check AC status.
+            */
+           switch (my_cur_info.ac_line_status) {
+
+               case 1:         
+                       /*
+                        *   AC on-line. I.e. we are "plugged-in".
+                        */
+                       copyXPMArea(68, 6, 26, 7, 31, 35);
+                       break;
+               default:        
+                       /*
+                        *   AC off-line. I.e. we are using battery.
+                        */
+                       copyXPMArea(68, 20, 26, 7, 31, 35);
+
+           }
+       
+
+
+
+           /* 
+            *    Paste up the default charge status and time
+            */
+           copyXPMArea(104,  6,  5, 7, 6, 7);
+           copyXPMArea(83, 93, 41, 9, 15, 7);
+
+
+
+
+
+           /*
+            *  Check to see if we are charging.
+            */
+           if ( (int)(my_cur_info.battery_status) == 3){
+
+               /*
+                *   Battery Status: Charging.
+                */
+               copyXPMArea(98,  6, 5, 7,  6,  7);
+               copyXPMArea(75, 81, 1, 2, 17,  9);
+               copyXPMArea(75, 81, 1, 2, 17, 12);
+
+           }  
+
+               
+
+
+
+           /*
+            *   Repaint buttons.
+            */
+           copyXPMArea(42, 106, 13, 11, 5, 48);
+           copyXPMArea(57, 106, 13, 11, 46, 48);
+
+
+
+
+
+
+
+       
+           /* 
+            *  Paste up the "Time Left". This time means:
+            *  
+            *         If not charging: Time left before battery drains to 0% 
+            *         If charging:     Time left before battery gets to maximum
+            *
+            */
+#ifdef Linux
+           if (my_cur_info.battery_time >= ((my_cur_info.using_minutes) ? 1440 
: 86400) ) {
+#else
+# ifdef FreeBSD
+           if (my_cur_info.battery_time >= 86400) {
+# endif
+#endif
+
+               /*
+                *  If battery_time is too large, it likely means that there is
+                *  no charging or discharging going on. So just display a 
"null"
+                *  indicator (--:--). 
+                *
+                */
+               copyXPMArea(83, 106, 41, 9, 15, 7);
+
+           } else if (my_cur_info.battery_time >= 0) {
+
+#ifdef Linux
+               time_left = (my_cur_info.using_minutes) ? 
my_cur_info.battery_time : my_cur_info.battery_time / 60;
+#endif
+#ifdef FreeBSD
+               time_left = (my_cur_info.using_minutes) ? 
my_cur_info.battery_time / 60 : my_cur_info.battery_time / 3600;
+#endif
+
+               hour_left = time_left / 60;
+               min_left  = time_left % 60;
+
+               copyXPMArea( (hour_left / 10) * 7 + 5, 93, 7, 9, 21, 7);        
/* Show 10's (hour) */
+               copyXPMArea((hour_left % 10) * 7 + 5, 93, 7, 9, 29, 7);         
/* Show 1's (hour)  */
+               copyXPMArea(76, 93, 2, 9, 38, 7);                               
/* colon            */
+               copyXPMArea((min_left / 10) * 7 + 5, 93, 7, 9, 42, 7);          
/* Show 10's (min)  */
+               copyXPMArea((min_left % 10) * 7 + 5, 93, 7, 9, 50, 7);          
/* Show 1's (min)   */
+
+           }
+       
+
+
+
+
+           /* 
+            *   Do Battery Percentage.
+            */
+           copyXPMArea(76, 81, 19, 7, 7, 34);                          /* Show 
Default % */
+           copyXPMArea(66, 31, 49, 9, 7, 21);                          /* Show 
Default Meter */
+           if (my_cur_info.battery_percentage == 100){
+                   copyXPMArea(15, 81, 1, 7,  7, 34);                  /* If 
100%, show 100% */
+                   copyXPMArea( 5, 81, 6, 7,  9, 34);
+                   copyXPMArea( 5, 81, 6, 7, 15, 34);
+                   copyXPMArea(64, 81, 7, 7, 21, 34);                  /* Show 
'%' */
+                   copyXPMArea(66, 42, 49, 9, 7, 21);                  /* Show 
Meter */
+           } else {
+
+               if (my_cur_info.battery_percentage >= 10)
+                   copyXPMArea((my_cur_info.battery_percentage / 10) * 6 + 4, 
81, 6, 7,  9, 34);       /* Show 10's */
+               copyXPMArea((my_cur_info.battery_percentage % 10) * 6 + 4, 81, 
6, 7, 15, 34);           /* Show 1's */
+               copyXPMArea(64, 81, 7, 7, 21, 34);                              
                        /* Show '%' */
+
+               /*
+                *  Show Meter
+                */
+               k = my_cur_info.battery_percentage * 49 / 100;
+               copyXPMArea(66, 42, k, 9, 7, 21);
+               if (k%2) 
+                   copyXPMArea(66+k-1, 52, 1, 9, 7+k-1, 21);
+               else     
+                   copyXPMArea(66+k, 52, 1, 9, 7+k, 21);
+           }
+
+
+
+       } else {
+
+           /*
+            *  Update the counter. When it hits nMax, we will 
+            *  process /proc/apm information again.
+            */
+           ++n;
+
+       }
+
+
+
+
+       /*
+        *  This controls the 3 LEDs
+        */
+       if (m>mMax){
+
+           m = 0;
+
+
+           if (( (int)(my_cur_info.battery_status) == 2)
+                   ||( (int)(my_cur_info.battery_percentage) <= CriticalLevel 
)){
+
+               /*
+                *  Battery Status: Critical.
+                *  Blink the red led on/off...
+                */
+               if (Toggle||(BlinkRate == 0.0)){
+                   if (Beep) XBell(display, Volume);
+                   Toggle = 0;
+                   copyXPMArea(95, 68, 4, 4, 24, 51);
+               } else{
+                   Toggle = 1;
+                   copyXPMArea(75, 68, 4, 4, 24, 51);
+               }
+               copyXPMArea(81, 68, 4, 4, 30, 51);              /* turn off 
yellow */
+               copyXPMArea(87, 68, 4, 4, 36, 51);              /* turn off 
green  */
+
+           } else if (( (int)(my_cur_info.battery_status) == 1)
+                   ||( (int)(my_cur_info.battery_percentage) <= LowLevel )){
+
+               /*
+                *  Battery Status: Low.
+                */
+               copyXPMArea(75,  68, 4, 4, 24, 51);             /* turn off red 
   */
+               copyXPMArea(101, 68, 4, 4, 30, 51);             /* turn ON  
yellow */
+               copyXPMArea(87,  68, 4, 4, 36, 51);             /* turn off 
green  */
+
+           } else if (( (int)( my_cur_info.battery_status ) == 0)
+                   ||( (int)(my_cur_info.battery_percentage) > LowLevel )){
+
+               /*
+                *  Battery Status: High.
+                */
+               copyXPMArea(75,  68, 4, 4, 24, 51);             /* turn off red 
   */
+               copyXPMArea(81,  68, 4, 4, 30, 51);             /* turn off 
yellow */
+               copyXPMArea(107, 68, 4, 4, 36, 51);             /* turn ON  
green  */
+
+           }
+
+
+       } else {
+
+           /*
+            *  Update the counter. 
+            */
+           ++m;
+
+       }
+
+
+
+
+       /*
+        *  This controls Critical Alerts
+        */
+       if (Alert){
+           if (( (int)(my_cur_info.battery_status) == 2)
+                   ||( (int)(my_cur_info.battery_percentage) <= CriticalLevel 
)){
+
+               if (s>sMax){
+
+                   s = 0;
+                   fp = popen("wall", "w");
+                   fprintf(fp, "Battery is critical!. Percent: %d\n", 
(int)(my_cur_info.battery_percentage));
+                   pclose(fp);
+
+               } else {
+
+                   /*
+                    *  Update the counter. 
+                    */
+                   ++s;
+
+               }
+
+           } else if (( (int)(my_cur_info.battery_status) == 1)
+                   ||( (int)(my_cur_info.battery_percentage) <= LowLevel )){
+
+               if (r>rMax){
+
+                   r = 0;
+                   fp = popen("wall", "w");
+                   fprintf(fp, "Battery is low. Percent: %d\n", 
(int)(my_cur_info.battery_percentage));
+                   pclose(fp);
+
+               } else {
+
+                   /*
+                    *  Update the counter. 
+                    */
+                   ++r;
+
+               }
+
+           }
+       }
+
+
+
+       /* 
+        *   Process any pending X events.
+        */
+        while(XPending(display)){
+            XNextEvent(display, &event);
+            switch(event.type){
+                case Expose:
+                        RedrawWindow();
+                        break;
+                case ButtonPress:
+                        pressEvent(&event.xbutton);
+                        break;
+                case ButtonRelease:
+                        break;
+            }
+        }
+
+
+
+
+
+       
+       /* 
+        *  Redraw and wait for next update 
+        */
+       RedrawWindow();
+       usleep(DELAY);
+
+
+     }
+
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ *  This routine handles button presses. Pressing the 'S' button
+ *  invokes 'apm -S' to place the machine into standby mode. And 
+ *  pressing the 'Z' buton invokes 'apm -s' to place the machine 
+ *  into suspend mode.
+ *
+ *  Note: in order for users other than root to be able to run 
+ *        'apm -s' and 'apm -S', you need to make apm suid (i.e. 
+ *        run 'chmod +s /usr/bin/apm' as root).  This will allow
+ *        'normal' users to execute apm with root privilages.
+ *
+ */
+void pressEvent(XButtonEvent *xev){
+
+   int x=xev->x;
+   int y=xev->y;
+
+   if(x>=5 && y>=48 && x<=17 && y<=58){
+
+       /*
+        *  Standby Call.
+        *
+        *  Draw button as 'pushed'. Redraw window to show it.
+        *  Call 'apm -S' to standby. Sleep for 2 seconds so that
+        *  the button doesnt immediately redraw back to unpressed
+        *  before the 'apm -S' takes effect.
+        */
+       copyXPMArea(5, 106, 13, 11, 5, 48);
+       RedrawWindow();
+#ifndef SunOS
+       system("apm -S");
+#endif
+       usleep(2000000L);
+
+   } else if (x>=46 && y>=48 && x<=58 && y<=58){
+
+       /*
+        *  Suspend Call.
+        *
+        *  Draw button as 'pushed'. Redraw window to show it.
+        *  Call 'apm -s' to suspend. Sleep for 2 seconds so that
+        *  the button doesnt immediately redraw back to unpressed
+        *  before the 'apm -s' takes effect.
+        */
+       copyXPMArea(21, 106, 13, 11, 46, 48);
+       RedrawWindow();
+#ifndef SunOS
+       system("apm -s");
+#endif
+       usleep(2000000L);
+
+   }
+
+   return;
+
+}
+
+
+
+
+
+
+/*  
+ *     apm_exists()  
+ *                     - Check to see if /proc/apm exists...
+ *     
+ */
+int apm_exists()
+{
+
+    if (access(APMDEV, R_OK))
+
+       /*
+        *  Cannot find /proc/apm
+        */
+       return 0;
+
+    else
+
+       return 1;
+
+}
+
+
+
+
+/*  
+ *     apm_read()  
+ *                     - Read in the information found in /proc/apm...
+ *
+ */
+#ifdef Linux
+int apm_read(struct my_apm_info *i){
+
+    FILE       *str;
+    char        units[10];
+    char        buffer[100];
+    int         retcode = 0;
+   
+    /*
+     *  Open /proc/apm for reading
+     */
+    if (!(str = fopen(APMDEV, "r")))
+       return 1;
+
+
+
+    /*
+     *  Scan in the information....
+     */
+    fgets(buffer, sizeof(buffer) - 1, str);
+    buffer[sizeof(buffer) - 1] = '\0';
+    sscanf(buffer, "%s %d.%d %x %x %x %x %d%% %d %s\n",
+         (char *)i->driver_version,
+         &i->apm_version_major,
+         &i->apm_version_minor,
+         &i->apm_flags,
+         &i->ac_line_status,
+         &i->battery_status,
+         &i->battery_flags,
+         &i->battery_percentage,
+         &i->battery_time,
+         units);
+
+
+    i->using_minutes = !strncmp(units, "min", 3) ? 1 : 0;
+
+
+
+    /*
+     *  Old Style
+     */
+    if (i->driver_version[0] == 'B') { 
+       strcpy((char *)i->driver_version, "pre-0.7");
+       i->apm_version_major  = 0;
+       i->apm_version_minor  = 0;
+       i->apm_flags          = 0;
+       i->ac_line_status     = 0xff;
+       i->battery_status     = 0xff;
+       i->battery_flags      = 0xff;
+       i->battery_percentage = -1;
+       i->battery_time       = -1;
+       i->using_minutes      = 1;
+
+
+
+      
+       sscanf(buffer, "BIOS version: %d.%d", &i->apm_version_major, 
&i->apm_version_minor);
+
+       fgets(buffer, sizeof(buffer) - 1, str);
+       sscanf(buffer, "Flags: 0x%02x", &i->apm_flags);
+
+       if (i->apm_flags & APM_32_BIT_SUPPORT) {
+
+           fgets(buffer, sizeof(buffer) - 1, str);
+           fgets(buffer, sizeof(buffer) - 1, str);
+
+           if (buffer[0] != 'P') {
+
+               if (!strncmp(buffer+4, "off line", 8))     i->ac_line_status = 
0;
+               else if (!strncmp(buffer+4, "on line", 7)) i->ac_line_status = 
1;
+               else if (!strncmp(buffer+4, "on back", 7)) i->ac_line_status = 
2;
+           
+               fgets(buffer, sizeof(buffer) - 1, str);
+               if (!strncmp(buffer+16, "high", 4))        i->battery_status = 
0;
+               else if (!strncmp(buffer+16, "low", 3))    i->battery_status = 
1;
+               else if (!strncmp(buffer+16, "crit", 4))   i->battery_status = 
2;
+               else if (!strncmp(buffer+16, "charg", 5))  i->battery_status = 
3;
+           
+               fgets(buffer, sizeof(buffer) - 1, str);
+               if (strncmp(buffer+14, "unknown", 7))      
i->battery_percentage = atoi(buffer + 14);
+
+               if (i->apm_version_major >= 1 && i->apm_version_minor >= 1) {
+                   fgets(buffer, sizeof(buffer) - 1, str);
+                   sscanf(buffer, "Battery flag: 0x%02x", &i->battery_flags);
+                   fgets(buffer, sizeof(buffer) - 1, str);
+                   if (strncmp(buffer+14, "unknown", 7))  i->battery_time = 
atoi(buffer + 14);
+               }
+
+
+           }
+       }
+    }
+   
+
+
+    /* 
+     *    Take care of battery percentages > 100%
+     */
+    if (i->battery_percentage > 100) i->battery_percentage = -1;
+   
+    fclose(str);
+    return retcode;
+
+}
+#else
+# ifdef FreeBSD
+int apm_read(apm_info_t temp_info) {
+
+    int fd;
+   
+    if ( (fd = open(APMDEV, O_RDWR)) < 0){
+
+       return(1);
+
+    } else if ( ioctl(fd, APMIO_GETINFO, temp_info) == -1 ) {
+
+        close(fd);
+        return(1);
+
+    } else {
+
+       close(fd);
+       return(0);
+
+    }
+
+}
+# endif
+#endif 
+
+#ifdef SunOS
+int apm_read(struct my_apm_info *i) {
+
+       int fd;
+       battery_t info;
+
+       memset(i,0,sizeof(*i));
+       if ((fd = open(APMDEV,O_RDONLY)) < 0) {
+               perror("open");
+               exit(1);
+       }
+ 
+       if (ioctl(fd,BATT_STATUS,&info) < 0) return(1);
+  
+       close(fd);
+       
+       i->battery_percentage = info.capacity;
+       i->battery_time = info.discharge_time;
+       i->using_minutes = 0;
+ 
+       /*  convert to internal status:
+        *
+        *  0 = high
+        *  1 = low
+        *  2 = critical
+        *  3 = charging
+        */
+       switch(info.status) {
+           case EMPTY:                         /* Battery has (effectively) no 
capacity */
+               i->battery_status = 2;
+               break;
+           case LOW_CAPACITY:                  /* Battery has less than 25% 
capacity */
+               i->battery_status = 1;
+               break;
+           case MED_CAPACITY:                  /* Battery has less than 50% 
capacity */
+               i->battery_status = 1;
+               break;
+           case HIGH_CAPACITY:                 /* Battery has less than 75% 
capacity */
+           case FULL_CAPACITY:                 /* Battery has more than 75% 
capacity */
+               i->battery_status = 0;
+               break;
+           default:
+               i->battery_status = 2;
+               break;
+       }
+ 
+       switch(info.charge) {
+           case DISCHARGE:                             /* Battery is 
discharging (i.e. in use) */
+               i->ac_line_status = 0;
+               break;
+           case FULL_CHARGE:                   /* Battery is charging at its 
fastest rate */
+           case TRICKLE_CHARGE:                /* Battery is charging at a 
slower rate */
+           default:
+               i->ac_line_status = 1;
+               break;
+       }
+ 
+       if (i->battery_percentage > 100) i->battery_percentage = 100;
+ 
+       /*  Not sure what else we can fill in right now.
+        *  Relevant information is:
+        *
+        *  info.id_string = type of battery (internal, external, etc)
+        *  info.total = total capacity (mWhrs)
+        */
+ 
+       return(0);
+       
+}
+#endif 
+
+
+
+/* 
+ *   ParseCMDLine()  
+ */
+void ParseCMDLine(int argc, char *argv[]) {
+char *cmdline;
+int  i,j;
+char puke[20];
+   
+    for (i = 1; i < argc; i++) {
+       cmdline = argv[i];
+
+       if (cmdline[0] == '-') {
+           switch(cmdline[1]) {
+               case 'd': 
+                       ++i;
+                       break;
+               case 'A': 
+                       Alert = 1;
+                       LAlertRate = atof(argv[++i]);
+                       CAlertRate = atof(argv[++i]);
+                       break;
+               case 'b': 
+                       BlinkRate = atof(argv[++i]);
+                       break;
+               case 'C': 
+                       CriticalLevel = atoi(argv[++i]);
+                       break;
+               case 'L': 
+                       LowLevel = atoi(argv[++i]);
+                       break;
+               case 'l': 
+                       UseLowColorPixmap = 1;
+                       break;
+               case 'B': 
+                       Beep = 1;
+                       Volume = atoi(argv[++i]);
+                       break;
+               default:  
+                       printf("\nwmapm version: %s\n", WMAPM_VERSION);
+                       printf("usage:\n");
+                       printf("\t-display <display>\tUse alternate 
display.\n");
+                       printf("\t-l\t\t\tUse a low-color pixmap to conserve 
colors on 8-bit displays.\n");
+                       printf("\t-L <LowLevel>\t\tDefine level at which yellow 
LED turns on.\n");
+                       printf("\t             \t\tCriticalLevel takes 
precedence if LowLevel<CriticalLevel.\n");
+                       printf("\t-C <CriticalLevel>\tDefine level at which red 
LED turns on.\n");
+                       printf("\t-b <BlinkRate>\t\tBlink rate for red LED. (0 
for no blinking.)\n");
+                       printf("\t-B <Volume>\t\tBeep at Critical Level. Volume 
is between -100%% to 100%%.\n");
+                       printf("\t-A <T1 T2>\t\tSend messages to users 
terminals when Low and critical.\n");
+                       printf("\t             \t\tT1 is seconds between 
messages when Low. T2 is seconds between messages when Critical.\n");
+                       printf("\t-h\t\t\tDisplay help screen.\n\n");
+                       exit(1);
+           }
+       }
+    }
+
+
+}
+
+
+
+
diff --git a/wmapm/wmapm/wmapm.gif b/wmapm/wmapm/wmapm.gif
new file mode 100644
index 
0000000000000000000000000000000000000000..fc1fb211567dfbd1fd19f2d98c7cf1665c34c635
GIT binary patch
literal 1703
zcmc(d`!}0+7{I@YAgC_Ewq8k9Nz%{|mmt=+8obDe+k`a}ro1*=vr9=!x3@*5p<NOt
z5n7>Ev6ZTB+B)6V8f%%hsY@HZ@VbmlwM{o#JH{s4AF<E*oX@Y%InVP%M252i(jfqW
z7vNvG0)R+Cn-NR_@E4%2!eCRGY$g+8`a(=L#0G%PhS?mL4Z)CEKE&liFdyas*bE<r
z1u#zl^96jqh@U9p3q%3{1Oh~`2N8%6ky)`QQ!GNnh*=4eD?!8(u^1J9ii#zuL?V?G
zN+qZiMdfI*9F@wYW>%|~maC<5wcM;$Ua6I<wQ99aU8_@Tby_oR+Qzn3ZuA>&=nZ-^
ztHty~nBIUH%o+_3jRwq!VJ2+Kgc(gn0F1^(<J_Xrv}js&e(}E@{9k352b*sJtXI&a
zq{QNcqw&&X@o{mnCt_n1$~WKSRq>*$HPKO#a2*`ca5_9}cT-d7*AOTwDV0gfzmO{x
zl`3^j^+|30>4vX#&0mLZ1jRf1c7}v-ZtH^wf`ftr?->Hw4+8xC{jhQ0NtX9C)A-wt
z$6il7pLt&I?YpVJGdMhAc))%%Hje##hnnxTxpV)H`<Ky|F{4g<fooJPe7>QlY#j@a
z5U-M0z$#R>DYCt>w}KkykaKN9U7tls=&Ow!bR)mU@cp!Mf{|5P$Fe4FW`0bKtH77r
z5@{545Jc}D?Y9AUSn|!>tgr*VQ+HaeI^7q7d_amqxUW^8^QHCO$`#?Y&phcL=Nj6x
z|8Ph-@47pQmTaFJvR?I6_^tajO~_f*xv`FYjvM{-^EpF(F{hQhp!xQAMZwaFJx9Wv
zxKjG7W=~<2-{kjnX8Gv2BhuT|l*9^|)m%)s;3jsrZU{^5*L3brcyXvR02yyzzy92@
zJS6ThytA~>cHvJ`_+WFHORUeLIAZ8TMOxb6mE4Hop$m2A;=^Qi0GpA={`fcSN_(iP
zbG&Dosrwu>plNQF%CMoL{9V-aVy74+y~N51Y_O%SetywXpme;%?F8alydkP*oZ#ZH
zZsHiTin{eE4SzAC%>HNHWI5|DOtAH6BWCb8Pm!tOH%_gHj}Tn^>+Ka0;VGHQXgt*G
z&ws6XZ)KuSicOXEQ5%htmpTy3<HOBa$AoxMWPp{d*O~00=DRzNcGEl#aMhwv!iQeZ
zkDn@#-OIK?v+!%{OFEK6ZAd_i*n5YS2nC_bcd6oSaueDZ&7e={n&Tu6`K{^i4Q0kF
zFq*DGLw`SAq?o#&(DcYk^G#h$Ds68SuBQ6TwntI%EyLdh9kFN|kZ;Sl)SFtBAR*T<
z#9JBLn;j-O(X)F<Zxw9+PABw8>gdlKc#@)eNAoyuaN@m|cZ_(f7b=fe(UZSvm$h`%
zRaQJZLnFsM^O#=4GeugJU1fB6leRqXc3Mf!ecrP!`>Z$FwO9{8eYZ%zYwprdq-gf@
z9+jB!K!q>eM5ldn(w#F)w;7q{gkE>Hp!D5fQX2KW)C=0*Z9VN?r}RU&co%NA&enR~
zrZBKS$VSAM9Fv-zn0=3Yn7=TbVwdq^B<mOEmtETya*p7T>%x-z8E-GM*0d1nUyc@9
z<IvPxRWj@0q1RUeh%ScXexpfqo<&@rx#fVg!+*b|jvq{L3naS~YSG)_gp>Kx%6&1H
z;WbRAgQZhB7vQw}Wd}%#ic^6zr!4q=L8q65m&WRQx*^NvQtmFxv!z_<)pHl4y5<fp
z0rZuc{FTeJD*>%9C&|NWIRh(QO|6}{vmX1dKE7!&L!Tc=NIUej$!#cj4CHz}{HUia
z^M~Ktwg(q19a^ec0Ag9*eCuZ&7Ng74l`SJ%<ay7Q_TYs2;HS8&1)sl-9bDs&w~lE%
z=nMl~X`B4dWv?Q-ZWFRW_x;$TTNYc~w4~9GcC}PTl+4U(ExkhtuZRH-@Oy&&!@ZYC
zaqo@<HFUF0KT&RxoY~%*KIOE}nZPGGCuN!;oqNZv1Lr?sW@b2+ES{h`AD2ZJjl8-{
z@T>j6o3MqnapDJJxQmP|g$$_kg6{AeS=blrh>esT5NyZ8<PLD7>sAtu$iWnArHyWz
g^{5pCQ`+%S_W*J=N}ymBL^d#lNA|@>xsgEdKZVfG(*OVf

literal 0
HcmV?d00001

diff --git a/wmapm/wmapm/wmapm.h b/wmapm/wmapm/wmapm.h
new file mode 100644
index 0000000..769b238
--- /dev/null
+++ b/wmapm/wmapm/wmapm.h
@@ -0,0 +1,56 @@
+/*
+ *     wmapm.h  -- Header file for WMAPM
+ *
+ *
+ *     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, 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 (see the file COPYING); if not, write to the
+ *     Free Software Foundation, Inc.,
+ *     59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ *
+ *
+ */
+
+
+
+
+#define DELAY 10000L           /* Delay between refreshes (in microseconds) */
+
+#define WMAPM_VERSION "3.1"
+
+#ifdef FreeBSD
+# define APMDEV "/dev/apm"
+#else
+# ifdef Linux
+#  define APMDEV "/proc/apm"
+# endif
+#endif
+
+typedef struct my_apm_info {
+    const char driver_version[10];
+    int        apm_version_major;
+    int        apm_version_minor;
+    int        apm_flags;
+    int        ac_line_status;
+    int        battery_status;
+    int        battery_flags;
+    int        battery_percentage;
+    int        battery_time;
+    int        using_minutes;
+} my_apm_info;
+
+#ifdef Linux
+struct my_apm_info apm_info;
+# ifndef APM_32_BIT_SUPPORT
+#  define APM_32_BIT_SUPPORT      0x0002
+# endif
+#endif
diff --git a/wmapm/wmapm/wmapm_mask.xbm b/wmapm/wmapm/wmapm_mask.xbm
new file mode 100644
index 0000000..d47dbb1
--- /dev/null
+++ b/wmapm/wmapm/wmapm_mask.xbm
@@ -0,0 +1,38 @@
+#define wmapm_mask_width 64
+#define wmapm_mask_height 64
+static char wmapm_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,
+ 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,
+ 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,
+ 0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,
+ 0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,
+ 0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,
+ 0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,
+ 0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,
+ 0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,0xf0,0xff,0xe7,0xff,0xff,0xe7,0xff,0x0f,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00};
diff --git a/wmapm/wmapm/wmapm_master.xpm b/wmapm/wmapm/wmapm_master.xpm
new file mode 100644
index 0000000..9657aa5
--- /dev/null
+++ b/wmapm/wmapm/wmapm_master.xpm
@@ -0,0 +1,171 @@
+/* XPM */
+static char *wmapm_master[] = {
+/* width height num_colors chars_per_pixel */
+"   128   120       44            1",
+/* colors */
+". c #000000",
+"# c #003900",
+"a c #3c0000",
+"b c #4c3c00",
+"c c #282828",
+"d c #00445a",
+"e c #006b8e",
+"f c #590000",
+"g c #48484a",
+"h c #0000ff",
+"i c #00e500",
+"j c #00ff00",
+"k c #1fff00",
+"l c #3fff00",
+"m c #5fff00",
+"n c #7fff00",
+"o c #00b0ea",
+"p c #e90000",
+"q c #ff0000",
+"r c #ff2600",
+"s c #ff4c00",
+"t c #ff7200",
+"u c #9fff00",
+"v c #bfff00",
+"w c #ff9800",
+"x c #ffbd00",
+"y c #dfff00",
+"z c #ffc500",
+"A c #ffcd00",
+"B c #ffd500",
+"C c #ffdd00",
+"D c #e9e900",
+"E c #ffe500",
+"F c #ffea00",
+"G c #ffef00",
+"H c #fff400",
+"I c #fffa00",
+"J c #ffff00",
+"K c #888888",
+"L c #999999",
+"M c #a0a0a0",
+"N c #b2b2b2",
+"O c #d3d3d3",
+"P c #f7f7ff",
+/* pixels */
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh........................................................hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhcccccccccccccccccccccccccccccchcccccccccccccchhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhcccccccooooocccccddddddddddccchccpppcccfffccchhhhhhhhhhhhhhhhh",
+"hhhh.ccfffccccccccccccooooccccoooocccccccccooooccccooooccccOhhhhhhccccccoccccooocccdccccccccdccchcpcccpcfcccfcchhhhhhhhhhhhhhhhh",
+"hhhh.cfcccfccccccccccoccccoccoccccoccceoccoccccoccoccccocccOhhhhhhccccccoccccocccccdccccccccddcchcpcccccfcccccchhhhhhhhhhhhhhhhh",
+"hhhh.cfccccccccccocccoccccoccoccccoccceoccoccccoccoccccocccOhhhhhhccccoooccccocccccdccccccccddcchcpcccccfcccccchhhhhhhhhhhhhhhhh",
+"hhhh.cfccccccccccocccoccccoccoccccocccccccoccccoccoccccocccOhhhhhhcccoccoccccooocccdccccccccddcchcpcccccfcccccchhhhhhhhhhhhhhhhh",
+"hhhh.cfccccccccoooooceddddecceddddeccccccceddddecceddddecccOhhhhhhccoccccooooocccccdccccccccdccchcpcccpcfcccfcchhhhhhhhhhhhhhhhh",
+"hhhh.cfcccfccccccocccoccccoccoccccocccccccoccccoccoccccocccOhhhhhhccoccccccccccccccddddddddddccchccpppcccfffccchhhhhhhhhhhhhhhhh",
+"hhhh.ccfffcccccccocccoccccoccoccccoccceoccoccccoccoccccocccOhhhhhhcccccccccccccccccccccccccccccchcccccccccccccchhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccoccccoccoccccoccceoccoccccoccoccccocccOhhhhhhcccccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.cccccccccccccccccooooccccoooocccccccccooooccccooooccccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhcccccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhcccccccdddddcccccooooooooooccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhccccccdccccdddcccoccccccccoccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhccccccdccccdcccccoccccccccoocchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhccccdddccccdcccccoccccccccoocchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhcccdccdccccdddcccoccccccccoocchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhccdccccdddddcccccoccccccccoccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhccdccccccccccccccooooooooooccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccocococococococococococococococococococococococococccOhhhhhhcccccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhcccccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccpcocococococococococococococococococococococococjcccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.cceccooocccooocccoccccccccccccccccccccccccccccccccccccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.ccococccococccococococcccccccccdddddcccccddddddddddcccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.ccococccococccoccococcccccccccdccccdddcccdccccccccdcccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.ccecedddecedddecccocccccccccccdccccdcccccdccccccccddccOhhhhhhdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdhhhhhhhhhhhhh",
+"hhhh.ccococccococccoccococcccccccdddccccdcccccdccccccccddccOhhhhhhccccccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhhh",
+"hhhh.ccococccococccococococcccccdccdccccdddcccdccccccccddccOhhhhhhpcocococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhh.ccoccooocccooocccccoccccccdccccdddddcccccdccccccccdcccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccdccccccccccccccddddddddddcccOhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhh.ccccccccccccccccccccccccccccccccccccccccccccccccccccccOhhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhhOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOhhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhh...............hh......................hh...............hhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhh.PPPPPPPPPPPPKOhh.ccccccccccccccccccccOhhcPPPPPPPPPPPPKOhhhhhhococococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhh.PNNNNNNNNNNN.Ohh.ccccccccccccccccccccOhhcPNNNNNNNNNNN.Ohhhhhhccccccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhhh",
+"hhhh.PNNNK...KNNN.Ohh.ccccccccccccccccccccOhhcPNNN.....NNN.Ohhhhhhpcocococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhh.PNNN.NNN.NNN.Ohh.cccaaccccbbcccc##cccOhhcPNNNKNNN.NNN.Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhh.PNNN.NNNNNNN.Ohh.ccagaaccbgbbcc#g##ccOhhcPNNNNNM.MNNN.OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhh.PNNNK...KNNN.Ohh.ccaaaaccbbbbcc####ccOhhcPNNNNM.MNNNN.OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhh.PNNNNNNN.NNN.Ohh.cccaaccccbbcccc##cccOhhcPNNNM.MNNNNN.OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhh.PNNN.NNN.NNN.Ohh.ccccccccccccccccccccOhhcPNNN.NNNKNNN.OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhh.PNNNK...KNNN.Ohh.ccccccccccccccccccccOhhcPNNN.....NNN.OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhh.PNNNNNNNNNNN.Ohh.ccccccccccccccccccccOhhcPNNNNNNNNNNN.OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhh.K............Ohh.ccccccccccccccccccccOhhcK............OhhhhhhqcqcrcsctcwcxczcAcBcCcEcFcGcHcIcJcycvcucncmclckcjhhhhhhhhhhhhh",
+"hhhhOOOOOOOOOOOOOOOhhOOOOOOOOOOOOOOOOOOOOOOhhOOOOOOOOOOOOOOOhhhhhhccccccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhpcocococococococococococococococococococococococjhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhcccccaaccccbbcccc##ccccccppccccDDcccciicccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccagaaccbgbbcc#g##ccccpPppccDPDDcciPiiccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccaaaaccbbbbcc####ccccppppccDDDDcciiiiccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhcccccaaccccbbcccc##ccccccppccccDDcccciicccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhccccccccccccccccccccccccccccccccccccccccccccchhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccchccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhccooocccdddeceoooeceoooecedddeceoooeceoooeceoooeceoooeceoooeccoccccccchcdccdddcccdddcccdcccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcocccocdcccocdcccocdcccococccococccdcocccdcdcccococccococccococococccchcdcdcccdcdcccdcdcdcdchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcocccocdcccocdcccocdcccococccococccdcocccdcdcccococccococccoccococccochcdcdcccdcdcccdccdcdcchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcedddeccdddeceoooeccoooeceoooeceoooeceoooeccdddeceoooeceoooecccocccccchcdcdddddcdddddcccdccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcocccocdcccococccdcdcccocdcccocdcccococccocdcccococccocdcccoccococcccchcdcdcccdcdcccdccdcdcchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcocccocdcccococccdcdcccocdcccocdcccococccocdcccococccocdcccococococcochcdcdcccdcdcccdcdcdcdchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhccooocccdddoceoooeceoooeccdddeceoooeceoooeccdddeceoooeceoooeccccoccccchcdccdddcccdddcccccdcchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccchccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccchhcccccccccccccccccccccccccccccccccccccccccccchh",
+"hhhhccoooocccddddeceooooeceooooeceddddeceooooeceooooeceooooeceooooeceooooecccccchhccccccccooooccccoooocccccccccooooccccooooccchh",
+"hhhhcoccccocdccccocdccccocdccccococcccococcccdcoccccdcdccccococcccococcccocceocchhcccccccoccccoccoccccoccceoccoccccoccoccccocchh",
+"hhhhcoccccocdccccocdccccocdccccococcccococcccdcoccccdcdccccococcccococcccocceocchhcccocccoccccoccoccccoccceoccoccccoccoccccocchh",
+"hhhhcoccccocdccccocdccccocdccccococcccococcccdcoccccdcdccccococcccococcccocccccchhcccocccoccccoccoccccocccccccoccccoccoccccocchh",
+"hhhhceddddeccddddeceooooeceooooeceooooeceooooeceooooeccddddeceooooeceooooecccccchhcoooooceddddecceddddeccccccceddddecceddddecchh",
+"hhhhcoccccocdccccococcccdcdccccocdccccocdccccococcccocdccccococcccocdccccocccccchhcccocccoccccoccoccccocccccccoccccoccoccccocchh",
+"hhhhcoccccocdccccococcccdcdccccocdccccocdccccococcccocdccccococcccocdccccocceocchhcccocccoccccoccoccccoccceoccoccccoccoccccocchh",
+"hhhhcoccccocdccccococcccdcdccccocdccccocdccccococcccocdccccococcccocdccccocceocchhcccccccoccccoccoccccoccceoccoccccoccoccccocchh",
+"hhhhccoooocccddddeceooooeceooooeccddddeceooooeceooooeccddddeceooooeceooooecccccchhccccccccooooccccoooocccccccccooooccccooooccchh",
+"hhhhcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccchhcccccccccccccccccccccccccccccccccccccccccccchh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcccccccccccccccccccccccccccccccchhhcccccccccccccccccccccccccccccccchhhhhhhhhhhcccccccccccccccccccccccccccccccccccccccccccchh",
+"hhhhc............Kccc............KcchhhcccPPPPPPPPPPPPKccPPPPPPPPPPPPKchhhhhhhhhhhccccccccddddccccddddcccccccccddddccccddddccchh",
+"hhhhc.NNNNNNNNNNNPccc.NNNNNNNNNNNPcchhhcccPNNNNNNNNNNN.ccPNNNNNNNNNNN.chhhhhhhhhhhcccccccdccccdccdccccdccceoccdccccdccdccccdcchh",
+"hhhhc.NNNK...KNNNPccc.NNN.....NNNPcchhhcccPNNNK...KNNN.ccPNNN.....NNN.chhhhhhhhhhhcccccccdccccdccdccccdccceoccdccccdccdccccdcchh",
+"hhhhc.NNN.NNN.NNNPccc.NNNKNNN.NNNPcchhhcccPNNN.NNN.NNN.ccPNNNKNNN.NNN.chhhhhhhhhhhcccccccdccccdccdccccdcccccccdccccdccdccccdcchh",
+"hhhhc.NNN.NNNNNNNPccc.NNNNNL.LNNNPcchhhcccPNNN.NNNNNNN.ccPNNNNNM.MNNN.chhhhhhhhhhhcoooooceooooecceooooeccccccceooooecceooooecchh",
+"hhhhc.NNNK...KNNNPccc.NNNNL.LNNNNPcchhhcccPNNNK...KNNN.ccPNNNNM.MNNNN.chhhhhhhhhhhcccccccdccccdccdccccdcccccccdccccdccdccccdcchh",
+"hhhhc.NNNNNNN.NNNPccc.NNNL.LNNNNNPcchhhcccPNNNNNNN.NNN.ccPNNNM.MNNNNN.chhhhhhhhhhhcccccccdccccdccdccccdccceoccdccccdccdccccdcchh",
+"hhhhc.NNN.NNN.NNNPccc.NNN.NNNKNNNPcchhhcccPNNN.NNN.NNN.ccPNNN.NNNKNNN.chhhhhhhhhhhcccccccdccccdccdccccdccceoccdccccdccdccccdcchh",
+"hhhhc.NNNK...KNNNPccc.NNN.....NNNPcchhhcccPNNNK...KNNN.ccPNNN.....NNN.chhhhhhhhhhhccccccccddddccccddddcccccccccddddccccddddccchh",
+"hhhhc.NNNNNNNNNNNPccc.NNNNNNNNNNNPcchhhcccPNNNNNNNNNNN.ccPNNNNNNNNNNN.chhhhhhhhhhhcccccccccccccccccccccccccccccccccccccccccccchh",
+"hhhhcKPPPPPPPPPPPPcccKPPPPPPPPPPPPcchhhcccK............ccK............chhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcccccccccccccccccccccccccccccccchhhcccccccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhcccccccccccccccccccccccccccccccchhhcccccccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
+"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
+};
diff --git a/wmapm/wmapm/wmapm_master_LowColor.xpm 
b/wmapm/wmapm/wmapm_master_LowColor.xpm
new file mode 100644
index 0000000..aec649a
--- /dev/null
+++ b/wmapm/wmapm/wmapm_master_LowColor.xpm
@@ -0,0 +1,137 @@
+/* XPM */
+static char *wmapm_master_LowColor[] = {
+/* width height num_colors chars_per_pixel */
+"   128   120       10            1",
+/* colors */
+". c #000000",
+"# c #004840",
+"a c #282828",
+"b c #00ff00",
+"c c #20b0a8",
+"d c #ff0000",
+"e c #ffff00",
+"f c #a8a8a8",
+"g c #d3d3d3",
+"h c #f7f7ff",
+/* pixels */
+"................................................................................................................................",
+"................................................................................................................................",
+"................................................................................................................................",
+"................................................................................................................................",
+"................................................................................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaa.................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......aaaaaaacccccaaaaa##########aaa.aadddaaa###aaa.................",
+".....aa###aaaaaaaaaaaaccccaaaaccccaaaaaaaaaccccaaaaccccaaaag......aaaaaacaaaacccaaa#aaaaaaaa#aaa.adaaada#aaa#aa.................",
+".....a#aaa#aaaaaaaaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaaag......aaaaaacaaaacaaaaa#aaaaaaaa##aa.adaaaaa#aaaaaa.................",
+".....a#aaaaaaaaaacaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaaag......aaaacccaaaacaaaaa#aaaaaaaa##aa.adaaaaa#aaaaaa.................",
+".....a#aaaaaaaaaacaaacaaaacaacaaaacaaaaaaacaaaacaacaaaacaaag......aaacaacaaaacccaaa#aaaaaaaa##aa.adaaaaa#aaaaaa.................",
+".....a#aaaaaaaaccccca######aa######aaaaaaa######aa######aaag......aacaaaacccccaaaaa#aaaaaaaa#aaa.adaaada#aaa#aa.................",
+".....a#aaa#aaaaaacaaacaaaacaacaaaacaaaaaaacaaaacaacaaaacaaag......aacaaaaaaaaaaaaaa##########aaa.aadddaaa###aaa.................",
+".....aa###aaaaaaacaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaaag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaa.................",
+".....aaaaaaaaaaaaaaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaaag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa................................",
+".....aaaaaaaaaaaaaaaaaccccaaaaccccaaaaaaaaaccccaaaaccccaaaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......aaaaaaa#####aaaaaccccccccccaaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aaaaaa#aaaa###aaacaaaaaaaacaaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aaaaaa#aaaa#aaaaacaaaaaaaaccaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aaaa###aaaa#aaaaacaaaaaaaaccaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aaa#aa#aaaa###aaacaaaaaaaaccaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aa#aaaa#####aaaaacaaaaaaaacaaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aa#aaaaaaaaaaaaaaccccccccccaaa................................",
+".....aacacacacacacacacacacacacacacacacacacacacacacacacacaaag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa................................",
+".....aadacacacacacacacacacacacacacacacacacacacacacacacabaaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aa#aacccaaacccaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aacacaaacacaaacacacacaaaaaaaaaa#####aaaaa##########aaag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aacacaaacacaaacaacacaaaaaaaaaa#aaaa###aaa#aaaaaaaa#aaag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aa#a#####a#####aaacaaaaaaaaaaa#aaaa#aaaaa#aaaaaaaa##aag......#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#a#.............",
+".....aacacaaacacaaacaacacaaaaaaaa###aaaa#aaaaa#aaaaaaaa##aag......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.............",
+".....aacacaaacacaaacacacacaaaaaa#aa#aaaa###aaa#aaaaaaaa##aag......dacacacacacacacacacacacacacacacacacacacacacacacab.............",
+".....aacaacccaaacccaaaaacaaaaaa#aaaa#####aaaaa#aaaaaaaa#aaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaa#aaaaaaaaaaaaaa##########aaag....................................................................",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+".....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag......cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+"....gggggggggggggggggggggggggggggggggggggggggggggggggggggggg......cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+"..................................................................cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+"..................................................................cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+"..................................................................cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+".....hhhhhhhhhhhhfg...aaaaaaaaaaaaaaaaaaaag..ahhhhhhhhhhhhfg......cacacacacacacacacacacacacacacacacacacacacacacacab.............",
+".....hfffffffffff.g...aaaaaaaaaaaaaaaaaaaag..ahfffffffffff.g......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.............",
+".....hffff...ffff.g...aaaaaaaaaaaaaaaaaaaag..ahfff.....fff.g......dacacacacacacacacacacacacacacacacacacacacacacacab.............",
+".....hfff.fff.fff.g...aaa##aaaa##aaaa##aaag..ahfffffff.fff.g....................................................................",
+".....hfff.fffffff.g...aa#a##aa#a##aa#a##aag..ahffffff.ffff.g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+".....hffff...ffff.g...aa####aa####aa####aag..ahfffff.fffff.g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+".....hfffffff.fff.g...aaa##aaaa##aaaa##aaag..ahffff.ffffff.g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+".....hfff.fff.fff.g...aaaaaaaaaaaaaaaaaaaag..ahfff.fffffff.g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+".....hffff...ffff.g...aaaaaaaaaaaaaaaaaaaag..ahfff.....fff.g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+".....hfffffffffff.g...aaaaaaaaaaaaaaaaaaaag..ahfffffffffff.g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+".....f............g...aaaaaaaaaaaaaaaaaaaag..af............g......dadadadadadaeaeaeaeaeaeaeaeaeaeaeabababababababab.............",
+"....ggggggggggggggg..gggggggggggggggggggggg..ggggggggggggggg......aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.............",
+"..................................................................dacacacacacacacacacacacacacacacacacacacacacacacab.............",
+"................................................................................................................................",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaa##aaaa##aaaa##aaaaaaddaaaaeeaaaabbaaaaaa............",
+".......................................................................aaaa#a##aa#a##aa#a##aaaadhddaaeheeaabhbbaaaaa............",
+".......................................................................aaaa####aa####aa####aaaaddddaaeeeeaabbbbaaaaa............",
+".......................................................................aaaaa##aaaa##aaaa##aaaaaaddaaaaeeaaaabbaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+".......................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa............",
+"................................................................................................................................",
+"................................................................................................................................",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaa................................",
+"....aacccaaa####a#ccc#a#ccc#a#####a#ccc#a#ccc#a#ccc#a#ccc#a#ccc#aacaaaaaaa.a#aa###aaa###aaa#aaaa................................",
+"....acaaaca#aaaca#aaaca#aaacacaaacacaaa#acaaa#a#aaacacaaacacaaacacacacaaaa.a#a#aaa#a#aaa#a#a#a#a................................",
+"....acaaaca#aaaca#aaaca#aaacacaaacacaaa#acaaa#a#aaacacaaacacaaacaacacaaaca.a#a#aaa#a#aaa#aa#a#aa................................",
+"....a#####aa####a#ccc#aaccc#a#ccc#a#ccc#a#ccc#aa####a#ccc#a#ccc#aaacaaaaaa.a#a#####a#####aaa#aaa................................",
+"....acaaaca#aaacacaaa#a#aaaca#aaaca#aaacacaaaca#aaacacaaaca#aaacaacacaaaaa.a#a#aaa#a#aaa#aa#a#aa................................",
+"....acaaaca#aaacacaaa#a#aaaca#aaaca#aaacacaaaca#aaacacaaaca#aaacacacacaaca.a#a#aaa#a#aaa#a#a#a#a................................",
+"....aacccaaa###ca#ccc#a#ccc#aa####a#ccc#a#ccc#aa####a#ccc#a#ccc#aaaacaaaaa.a#aa###aaa###aaaaa#aa................................",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaa................................",
+"................................................................................................................................",
+"................................................................................................................................",
+"................................................................................................................................",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..",
+"....aaccccaaa#####a#cccc#a#cccc#a######a#cccc#a#cccc#a#cccc#a#cccc#a#cccc#aaaaaa..aaaaaaaaccccaaaaccccaaaaaaaaaccccaaaaccccaaa..",
+"....acaaaaca#aaaaca#aaaaca#aaaacacaaaacacaaaa#acaaaa#a#aaaacacaaaacacaaaacaa#caa..aaaaaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaa..",
+"....acaaaaca#aaaaca#aaaaca#aaaacacaaaacacaaaa#acaaaa#a#aaaacacaaaacacaaaacaa#caa..aaacaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaa..",
+"....acaaaaca#aaaaca#aaaaca#aaaacacaaaacacaaaa#acaaaa#a#aaaacacaaaacacaaaacaaaaaa..aaacaaacaaaacaacaaaacaaaaaaacaaaacaacaaaacaa..",
+"....a######aa#####a#cccc#a#cccc#a#cccc#a#cccc#a#cccc#aa#####a#cccc#a#cccc#aaaaaa..accccca######aa######aaaaaaa######aa######aa..",
+"....acaaaaca#aaaacacaaaa#a#aaaaca#aaaaca#aaaacacaaaaca#aaaacacaaaaca#aaaacaaaaaa..aaacaaacaaaacaacaaaacaaaaaaacaaaacaacaaaacaa..",
+"....acaaaaca#aaaacacaaaa#a#aaaaca#aaaaca#aaaacacaaaaca#aaaacacaaaaca#aaaacaa#caa..aaacaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaa..",
+"....acaaaaca#aaaacacaaaa#a#aaaaca#aaaaca#aaaacacaaaaca#aaaacacaaaaca#aaaacaa#caa..aaaaaaacaaaacaacaaaacaaa#caacaaaacaacaaaacaa..",
+"....aaccccaaa#####a#cccc#a#cccc#aa#####a#cccc#a#cccc#aa#####a#cccc#a#cccc#aaaaaa..aaaaaaaaccccaaaaccccaaaaaaaaaccccaaaaccccaaa..",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..",
+"................................................................................................................................",
+"................................................................................................................................",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...........aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..",
+"....a............faaa............faa...aaahhhhhhhhhhhhfaahhhhhhhhhhhhfa...........aaaaaaaa####aaaa####aaaaaaaaa####aaaa####aaa..",
+"....a.fffffffffffhaaa.fffffffffffhaa...aaahfffffffffff.aahfffffffffff.a...........aaaaaaa#aaaa#aa#aaaa#aaa#caa#aaaa#aa#aaaa#aa..",
+"....a.ffff...ffffhaaa.fff.....fffhaa...aaahffff...ffff.aahfff.....fff.a...........aaaaaaa#aaaa#aa#aaaa#aaa#caa#aaaa#aa#aaaa#aa..",
+"....a.fff.fff.fffhaaa.fffffff.fffhaa...aaahfff.fff.fff.aahfffffff.fff.a...........aaaaaaa#aaaa#aa#aaaa#aaaaaaa#aaaa#aa#aaaa#aa..",
+"....a.fff.fffffffhaaa.ffffff.ffffhaa...aaahfff.fffffff.aahffffff.ffff.a...........accccca#cccc#aa#cccc#aaaaaaa#cccc#aa#cccc#aa..",
+"....a.ffff...ffffhaaa.fffff.fffffhaa...aaahffff...ffff.aahfffff.fffff.a...........aaaaaaa#aaaa#aa#aaaa#aaaaaaa#aaaa#aa#aaaa#aa..",
+"....a.fffffff.fffhaaa.ffff.ffffffhaa...aaahfffffff.fff.aahffff.ffffff.a...........aaaaaaa#aaaa#aa#aaaa#aaa#caa#aaaa#aa#aaaa#aa..",
+"....a.fff.fff.fffhaaa.fff.fffffffhaa...aaahfff.fff.fff.aahfff.fffffff.a...........aaaaaaa#aaaa#aa#aaaa#aaa#caa#aaaa#aa#aaaa#aa..",
+"....a.ffff...ffffhaaa.fff.....fffhaa...aaahffff...ffff.aahfff.....fff.a...........aaaaaaaa####aaaa####aaaaaaaaa####aaaa####aaa..",
+"....a.fffffffffffhaaa.fffffffffffhaa...aaahfffffffffff.aahfffffffffff.a...........aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..",
+"....afhhhhhhhhhhhhaaafhhhhhhhhhhhhaa...aaaf............aaf............a.........................................................",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.........................................................",
+"....aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.........................................................",
+"................................................................................................................................"
+};
diff --git a/wmapm/wmgeneral/wmgeneral.c b/wmapm/wmgeneral/wmgeneral.c
new file mode 100644
index 0000000..a4f13c1
--- /dev/null
+++ b/wmapm/wmgeneral/wmgeneral.c
@@ -0,0 +1,366 @@
+/*
+       Best viewed with vim5, using ts=4
+
+       wmgeneral was taken from wmppp.
+
+       It has a lot of routines which most of the wm* programs use.
+
+       ------------------------------------------------------------
+
+       Author: Martijn Pieterse (piete...@xs4all.nl)
+
+       ---
+       CHANGES:
+       ---
+       02/05/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * changed the read_rc_file to parse_rcfile, as suggester by 
Marcelo E. Magallon
+               * debugged the parse_rc file.
+       30/04/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * Ripped similar code from all the wm* programs,
+                 and put them in a single file.
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <X11/Xlib.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+#include "wmgeneral.h"
+
+  /*****************/
+ /* X11 Variables */
+/*****************/
+
+Window         Root;
+int                    screen;
+int                    x_fd;
+int                    d_depth;
+XSizeHints     mysizehints;
+XWMHints       mywmhints;
+Pixel          back_pix, fore_pix;
+char           *Geometry = "";
+Window         iconwin, win;
+GC                     NormalGC;
+XpmIcon                wmgen;
+Pixmap         pixmask;
+
+  /*****************/
+ /* Mouse Regions */
+/*****************/
+
+typedef struct {
+       int             enable;
+       int             top;
+       int             bottom;
+       int             left;
+       int             right;
+} MOUSE_REGION;
+
+#define MAX_MOUSE_REGION (8)
+MOUSE_REGION   mouse_region[MAX_MOUSE_REGION];
+
+  /***********************/
+ /* Function Prototypes */
+/***********************/
+
+static void GetXPM(XpmIcon *, char **);
+static Pixel GetColor(char *);
+void RedrawWindow(void);
+void AddMouseRegion(int, int, int, int, int);
+int CheckMouseRegion(int, int);
+
+/*******************************************************************************\
+|* read_rc_file                                                                
                                                                   *|
+\*******************************************************************************/
+
+void parse_rcfile(const char *filename, rckeys *keys) {
+
+       char    *p;
+       char    temp[128];
+       char    *tokens = " :\t\n";
+       FILE    *fp;
+       int             i,key;
+
+       fp = fopen(filename, "r");
+       if (fp) {
+               while (fgets(temp, 128, fp)) {
+                       key = 0;
+                       while (key >= 0 && keys[key].label) {
+                               if ((p = strstr(temp, keys[key].label))) {
+                                       p += strlen(keys[key].label);
+                                       p += strspn(p, tokens);
+                                       if ((i = strcspn(p, "#\n"))) p[i] = 0;
+                                       free(*keys[key].var);
+                                       *keys[key].var = strdup(p);
+                                       key = -1;
+                               } else key++;
+                       }
+               }
+               fclose(fp);
+       }
+}
+
+
+/*******************************************************************************\
+|* GetXPM                                                                      
                                                                   *|
+\*******************************************************************************/
+
+static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
+
+       XWindowAttributes       attributes;
+       int                                     err;
+
+       /* For the colormap */
+       XGetWindowAttributes(display, Root, &attributes);
+
+       wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+
+       err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, 
&(wmgen->pixmap),
+                                       &(wmgen->mask), &(wmgen->attributes));
+       
+       if (err != XpmSuccess) {
+               fprintf(stderr, "Not enough free colorcells.\n");
+               exit(1);
+       }
+}
+
+/*******************************************************************************\
+|* GetColor                                                                    
                                                                   *|
+\*******************************************************************************/
+
+static Pixel GetColor(char *name) {
+
+       XColor                          color;
+       XWindowAttributes       attributes;
+
+       XGetWindowAttributes(display, Root, &attributes);
+
+       color.pixel = 0;
+       if (!XParseColor(display, attributes.colormap, name, &color)) {
+               fprintf(stderr, "wm.app: can't parse %s.\n", name);
+       } else if (!XAllocColor(display, attributes.colormap, &color)) {
+               fprintf(stderr, "wm.app: can't allocate %s.\n", name);
+       }
+       return color.pixel;
+}
+
+/*******************************************************************************\
+|* flush_expose                                                                
                                                                   *|
+\*******************************************************************************/
+
+static int flush_expose(Window w) {
+
+       XEvent          dummy;
+       int                     i=0;
+
+       while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
+               i++;
+
+       return i;
+}
+
+/*******************************************************************************\
+|* RedrawWindow                                                                
                                                                   *|
+\*******************************************************************************/
+
+void RedrawWindow(void) {
+       
+       flush_expose(iconwin);
+       XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 
+                               0,0, wmgen.attributes.width, 
wmgen.attributes.height, 0,0);
+       flush_expose(win);
+       XCopyArea(display, wmgen.pixmap, win, NormalGC,
+                               0,0, wmgen.attributes.width, 
wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* RedrawWindowXY                                                              
                                                           *|
+\*******************************************************************************/
+
+void RedrawWindowXY(int x, int y) {
+       
+       flush_expose(iconwin);
+       XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 
+                               x,y, wmgen.attributes.width, 
wmgen.attributes.height, 0,0);
+       flush_expose(win);
+       XCopyArea(display, wmgen.pixmap, win, NormalGC,
+                               x,y, wmgen.attributes.width, 
wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* AddMouseRegion                                                              
                                                           *|
+\*******************************************************************************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom) {
+
+       if (index < MAX_MOUSE_REGION) {
+               mouse_region[index].enable = 1;
+               mouse_region[index].top = top;
+               mouse_region[index].left = left;
+               mouse_region[index].bottom = bottom;
+               mouse_region[index].right = right;
+       }
+}
+
+/*******************************************************************************\
+|* CheckMouseRegion                                                            
                                                           *|
+\*******************************************************************************/
+
+int CheckMouseRegion(int x, int y) {
+
+       int             i;
+       int             found;
+
+       found = 0;
+
+       for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
+               if (mouse_region[i].enable &&
+                       x <= mouse_region[i].right &&
+                       x >= mouse_region[i].left &&
+                       y <= mouse_region[i].bottom &&
+                       y >= mouse_region[i].top)
+                       found = 1;
+       }
+       if (!found) return -1;
+       return (i-1);
+}
+
+/*******************************************************************************\
+|* copyXPMArea                                                                 
                                                           *|
+\*******************************************************************************/
+
+void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+       XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, 
dx, dy);
+
+}
+
+/*******************************************************************************\
+|* copyXBMArea                                                                 
                                                           *|
+\*******************************************************************************/
+
+void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+       XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, 
dx, dy);
+}
+
+
+/*******************************************************************************\
+|* setMaskXY                                                                   
                                                           *|
+\*******************************************************************************/
+
+void setMaskXY(int x, int y) {
+
+        XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, 
ShapeSet);
+        XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, 
ShapeSet);
+}
+
+/*******************************************************************************\
+|* openXwindow                                                                 
                                                           *|
+\*******************************************************************************/
+void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char 
*pixmask_bits, int pixmask_width, int pixmask_height) {
+
+       unsigned int    borderwidth = 1;
+       XClassHint              classHint;
+       char                    *display_name = NULL;
+       char                    *wname = argv[0];
+       XTextProperty   name;
+
+       XGCValues               gcv;
+       unsigned long   gcm;
+
+
+       int                             dummy=0;
+       int                             i;
+
+       for (i=1; argv[i]; i++) {
+               if (!strcmp(argv[i], "-display")) 
+                       display_name = argv[i+1];
+       }
+
+       if (!(display = XOpenDisplay(display_name))) {
+               fprintf(stderr, "%s: can't open display %s\n", 
+                                               wname, 
XDisplayName(display_name));
+               exit(1);
+       }
+       screen  = DefaultScreen(display);
+       Root    = RootWindow(display, screen);
+       d_depth = DefaultDepth(display, screen);
+       x_fd    = XConnectionNumber(display);
+
+       /* Convert XPM to XImage */
+       GetXPM(&wmgen, pixmap_bytes);
+
+       /* Create a window to hold the stuff */
+       mysizehints.flags = USSize | USPosition;
+       mysizehints.x = 0;
+       mysizehints.y = 0;
+
+       back_pix = GetColor("white");
+       fore_pix = GetColor("black");
+
+       XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
+                               &mysizehints.x, 
&mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
+
+       mysizehints.width = 64;
+       mysizehints.height = 64;
+               
+       win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
+                               mysizehints.width, mysizehints.height, 
borderwidth, fore_pix, back_pix);
+       
+       iconwin = XCreateSimpleWindow(display, win, mysizehints.x, 
mysizehints.y,
+                               mysizehints.width, mysizehints.height, 
borderwidth, fore_pix, back_pix);
+
+       /* Activate hints */
+       XSetWMNormalHints(display, win, &mysizehints);
+       classHint.res_name = wname;
+       classHint.res_class = wname;
+       XSetClassHint(display, win, &classHint);
+
+       XSelectInput(display, win, ButtonPressMask | ExposureMask | 
ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+       XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | 
ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+
+       if (XStringListToTextProperty(&wname, 1, &name) == 0) {
+               fprintf(stderr, "%s: can't allocate window name\n", wname);
+               exit(1);
+       }
+
+       XSetWMName(display, win, &name);
+
+       /* Create GC for drawing */
+       
+       gcm = GCForeground | GCBackground | GCGraphicsExposures;
+       gcv.foreground = fore_pix;
+       gcv.background = back_pix;
+       gcv.graphics_exposures = 0;
+       NormalGC = XCreateGC(display, Root, gcm, &gcv);
+
+       /* ONLYSHAPE ON */
+
+       pixmask = XCreateBitmapFromData(display, win, pixmask_bits, 
pixmask_width, pixmask_height);
+
+       XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
+       XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, 
ShapeSet);
+
+       /* ONLYSHAPE OFF */
+
+       mywmhints.initial_state = WithdrawnState;
+       mywmhints.icon_window = iconwin;
+       mywmhints.icon_x = mysizehints.x;
+       mywmhints.icon_y = mysizehints.y;
+       mywmhints.window_group = win;
+       mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | 
WindowGroupHint;
+
+       XSetWMHints(display, win, &mywmhints);
+
+       XSetCommand(display, win, argv, argc);
+       XMapWindow(display, win);
+
+}
diff --git a/wmapm/wmgeneral/wmgeneral.h b/wmapm/wmgeneral/wmgeneral.h
new file mode 100644
index 0000000..55b37dd
--- /dev/null
+++ b/wmapm/wmgeneral/wmgeneral.h
@@ -0,0 +1,50 @@
+#ifndef WMGENERAL_H_INCLUDED
+#define WMGENERAL_H_INCLUDED
+
+  /***********/
+ /* Defines */
+/***********/
+
+#define MAX_MOUSE_REGION (8)
+
+  /************/
+ /* Typedefs */
+/************/
+
+typedef struct _rckeys rckeys;
+
+struct _rckeys {
+       const char      *label;
+       char            **var;
+};
+
+typedef struct {
+       Pixmap                  pixmap;
+       Pixmap                  mask;
+       XpmAttributes   attributes;
+} XpmIcon;
+
+  /*******************/
+ /* Global variable */
+/*******************/
+
+Display                *display;
+
+  /***********************/
+ /* Function Prototypes */
+/***********************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom);
+int CheckMouseRegion(int x, int y);
+
+void openXwindow(int argc, char *argv[], char **, char *, int, int);
+void RedrawWindow(void);
+void RedrawWindowXY(int x, int y);
+
+void copyXPMArea(int, int, int, int, int, int);
+void copyXBMArea(int, int, int, int, int, int);
+void setMaskXY(int, int);
+
+void parse_rcfile(const char *, rckeys *);
+
+#endif
-- 
2.11.0


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to