From:
https://web.archive.org/web/20040722180350/http://nis-www.lanl.gov/~mgh/WindowMaker/wmGrabImage-0.72.tgz
---
 wmgrabimage/BUGS                               |   1 +
 wmgrabimage/CHANGES                            |  45 ++
 wmgrabimage/COPYING                            | 339 +++++++++++++
 wmgrabimage/HINTS                              |  38 ++
 wmgrabimage/INSTALL                            |  29 ++
 wmgrabimage/TODO                               |  15 +
 wmgrabimage/wmGrabImage/GrabImage              |  69 +++
 wmgrabimage/wmGrabImage/Makefile               |  34 ++
 wmgrabimage/wmGrabImage/wmGrabImage.1          |  56 +++
 wmgrabimage/wmGrabImage/wmGrabImage.c          | 637 +++++++++++++++++++++++++
 wmgrabimage/wmGrabImage/wmGrabImage_mask.xbm   |  38 ++
 wmgrabimage/wmGrabImage/wmGrabImage_master.xpm | 211 ++++++++
 wmgrabimage/wmgeneral/wmgeneral.c              | 363 ++++++++++++++
 wmgrabimage/wmgeneral/wmgeneral.h              |  54 +++
 14 files changed, 1929 insertions(+)
 create mode 100644 wmgrabimage/BUGS
 create mode 100644 wmgrabimage/CHANGES
 create mode 100644 wmgrabimage/COPYING
 create mode 100644 wmgrabimage/HINTS
 create mode 100644 wmgrabimage/INSTALL
 create mode 100644 wmgrabimage/TODO
 create mode 100755 wmgrabimage/wmGrabImage/GrabImage
 create mode 100644 wmgrabimage/wmGrabImage/Makefile
 create mode 100644 wmgrabimage/wmGrabImage/wmGrabImage.1
 create mode 100644 wmgrabimage/wmGrabImage/wmGrabImage.c
 create mode 100644 wmgrabimage/wmGrabImage/wmGrabImage_mask.xbm
 create mode 100644 wmgrabimage/wmGrabImage/wmGrabImage_master.xpm
 create mode 100644 wmgrabimage/wmgeneral/wmgeneral.c
 create mode 100644 wmgrabimage/wmgeneral/wmgeneral.h

diff --git a/wmgrabimage/BUGS b/wmgrabimage/BUGS
new file mode 100644
index 0000000..32f5c37
--- /dev/null
+++ b/wmgrabimage/BUGS
@@ -0,0 +1 @@
+Please send bug reports to mghender...@lanl.gov
diff --git a/wmgrabimage/CHANGES b/wmgrabimage/CHANGES
new file mode 100644
index 0000000..ecaa95a
--- /dev/null
+++ b/wmgrabimage/CHANGES
@@ -0,0 +1,45 @@
+wmGrabImage
+
+Version         Description
+-------------------------------------------------------------------------
+Version 0.70  - March 28, 1999.
+               Added support for local images (e.g. file:///home/mgh/junk.gif.)
+
+Version 0.66  - February 23, 1999.
+               Added help line for -delay option. And added a man page.
+
+Version 0.65  - February 11, 1999.
+               Now starts netscape if not already running...
+
+Version 0.64  - February 9, 1999.
+               Added command-line option for "Time between updates"
+
+Version 0.63  - February 9, 1999.
+               Fixed (potential) memory leak in the ShapeMask Pixmap
+               (gets returned only if color None is used in xpm file)
+               Added XFreeColors call.
+
+Version 0.62  - February 4, 1999.
+               buf fixes. Added -c option to center vertically.
+
+
+Version 0.61  - February 2, 1999.
+               Added Attributes support for Xpm Creation.
+               Also, added a kludge to GrabImage to stream edit
+               any "Transparent" colors that may get generated. (Change them
+               to black.)
+
+Version 0.6   - February 2, 1999.
+               Some bug fixes. Added Double click support.
+               Now, DoubleClick's do the following:
+               
+                       Button1: display original size image via xv.
+
+                       Button2: send another URL (specified with the -http
+                       command line option) to netscape.
+
+                       Button3: Force Update.
+
+
+Version 0.5   - initial (very) beta release February 1, 1999.
+
diff --git a/wmgrabimage/COPYING b/wmgrabimage/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/wmgrabimage/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/wmgrabimage/HINTS b/wmgrabimage/HINTS
new file mode 100644
index 0000000..dcdf40d
--- /dev/null
+++ b/wmgrabimage/HINTS
@@ -0,0 +1,38 @@
+Hints for wmGrabImage
+
+Generic.
+--------
+wmGrabImage version: 0.5
+
+usage: wmGrabImage [-h] [-display <display>] -url <URL>
+
+        -d <display>                   Use alternate display.
+        -h                             Display help screen.
+        -url <URL>                     This option tells wmGrabImage 
+                                       which WWW image to monitor.
+
+
+
+WindowMaker.
+------------
+In WindowMaker simply drag and drop the wmGrabImage App on
+the WindowMaker Dock or Clip.
+
+
+Afterstep.
+---------
+Afterstep users put the following in their .steprc
+"Wharf wmGrabImage - MaxSwallow "wmGrabImage" wmGrabImage &".
+
+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 window managers.
+----------------------
+wmGrabImage shows as a 64x64 shaped icon on your desktop under other
+window managers.
+
+
+
diff --git a/wmgrabimage/INSTALL b/wmgrabimage/INSTALL
new file mode 100644
index 0000000..30f7dec
--- /dev/null
+++ b/wmgrabimage/INSTALL
@@ -0,0 +1,29 @@
+Installation instructions for wmGrabImage.
+
+Requirements
+-------------------------------------------------------------------------------
+You will need the following free packages to be installed on your system:
+       1) ImageMagick  (I use the convert utility (and I want to keep it that 
way
+                        so I can also use all its the processing capabilites 
in future
+                        releases.))
+       2) GNU wget
+Plus:
+wmGrabImage requires the Xpm library (which should be available on most
+machines with XFree86 installed).  (Also, you obviously need to be connected to
+internet in a way that wget will work.)
+
+Installation
+-------------------------------------------------------------------------------
+1) gunzip wmGrabImage-1.0.tar.gz
+1) tar -xvf wmGrabImage-1.0.tar
+2) cd wmGrabImage-1.0/wmGrabImage/
+3) make 
+4) make install (must be root) 
+5) wmGrabImage & (or 'wmGrabImage -h' for help, or 'man wmGrabImage' for the 
man page)
+6) You need to set the location of perl correctly in GrabImage if your perl
+   is located in a place other than /usr/bin/
+
+
+
+
+
diff --git a/wmgrabimage/TODO b/wmgrabimage/TODO
new file mode 100644
index 0000000..23c0b04
--- /dev/null
+++ b/wmgrabimage/TODO
@@ -0,0 +1,15 @@
+For version 0.80
+----------------
+Allow user to specify command line options for imagemagick convert
+routine. This way, we immediatley buy into the impreesive cabablities
+of convert. (E.g. limit colors,filtering, blurring, sharpening, annotating 
+and so on....).
+
+For version 0.90
+----------------
+Check (fix?)  color stuff on 8-bit displays
+
+For version 1.00
+----------------
+Allow user to use user-defined image viewer. E.g. ee. Bug fixes?
+
diff --git a/wmgrabimage/wmGrabImage/GrabImage 
b/wmgrabimage/wmGrabImage/GrabImage
new file mode 100755
index 0000000..cb20894
--- /dev/null
+++ b/wmgrabimage/wmGrabImage/GrabImage
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+
+#
+#    Grabs an image on the WWW and resizes it (with antialiasing) down so that 
it can be
+#    displayed in a WindowMaker DockApp.
+
+#    Need to give it the URL of the image like so;
+#
+#           GrabWeather http://whatever.com/image.gif
+#
+
+
+    require "ctime.pl";
+
+
+    #
+    #  Change to users home directory. We used to dump into /tmp
+    #  but using home dir instead avoids multiple users interfering
+    #  with one another. (Yeah, we could "unique-ize" the filenames, but
+    #  this is easier for now...)
+    #
+    $home = (getpwuid($<))[7];
+    $ok = chdir() || chdir($home);
+
+
+    #
+    #  Check to see if .wmGrabImage exists.
+    #  If not, make it and move to it.
+    #
+    if ( !(-e ".wmGrabImage") ){
+       mkdir(".wmGrabImage", 0775);
+    }
+    chdir(".wmGrabImage");
+
+
+
+
+
+    $URL       = $ARGV[0];
+    $Geometry  = $ARGV[1];
+    $ImageName = $URL;
+    $ImageName =~ s/.*\/(.*)$/\1/;
+    if ($URL =~ /^file:\/\//) {
+
+       $ImagePath = $URL;
+       $ImagePath =~ s+file://(.*)+\1+;
+       system("cp $ImagePath $home/.wmGrabImage/$ImageName");
+
+    } else {
+
+
+        #
+        #  I think some of these wget command line options may cause problems
+        #  for some people? Dont know why...
+        #
+        $GrabCmd = "wget --proxy=off --passive-ftp --tries 0 -q -O 
$home/.wmGrabImage/$ImageName $URL";
+        system "$GrabCmd";
+
+    }
+
+
+if (! ($Geometry eq "") ) {
+    system "convert -crop $Geometry $home/.wmGrabImage/${ImageName} 
$home/.wmGrabImage/${ImageName}.tmp.gif" ;
+    system "convert -geom 54x54 $home/.wmGrabImage/${ImageName}.tmp.gif 
${home}/.wmGrabImage/${ImageName}.tmp.xpm";
+} else {
+    system "convert -geom 54x54 $home/.wmGrabImage/${ImageName} 
${home}/.wmGrabImage/${ImageName}.tmp.xpm";
+}
+    system "cat ${home}/.wmGrabImage/${ImageName}.tmp.xpm | sed -e 
\"s/Transparent/Black/\" \> ${home}/.wmGrabImage/${ImageName}.xpm; rm 
${home}/.wmGrabImage/${ImageName}.tmp.xpm";
+
diff --git a/wmgrabimage/wmGrabImage/Makefile b/wmgrabimage/wmGrabImage/Makefile
new file mode 100644
index 0000000..d4ef5a5
--- /dev/null
+++ b/wmgrabimage/wmGrabImage/Makefile
@@ -0,0 +1,34 @@
+CC     = gcc
+CFLAGS = -O2 -Wall
+INCDIR = -I/usr/X11R6/include/X11
+DESTDIR= /usr/X11R6
+LIBDIR = -L/usr/X11R6/lib
+# for linux
+LIBS   = -lXpm -lX11 -lXext
+# for Solaris
+# LIBS   = -lXpm -lX11 -lXext -lsocket
+OBJS   = wmGrabImage.o \
+         ../wmgeneral/wmgeneral.o
+
+
+.c.o:
+       $(CC) $(CFLAGS) -D$(shell echo `uname -s`) -c $< -o $*.o $(INCDIR)
+
+
+all:   wmGrabImage.o wmGrabImage
+
+wmGrabImage.o: wmGrabImage_master.xpm wmGrabImage_mask.xbm
+wmGrabImage:   $(OBJS) 
+       $(CC) $(CFLAGS) $(SYSTEM) -o wmGrabImage $^ $(INCDIR) $(LIBDIR) $(LIBS)
+
+clean:
+       for i in $(OBJS) ; do \
+               rm -f $$i; \
+       done
+       rm -f wmGrabImage
+
+install:: wmGrabImage
+       install -s -m 0755 wmGrabImage $(DESTDIR)/bin
+       install    -m 0755 GrabImage $(DESTDIR)/bin
+       install    -m 0644 wmGrabImage.1 $(DESTDIR)/man/man1 
+
diff --git a/wmgrabimage/wmGrabImage/wmGrabImage.1 
b/wmgrabimage/wmGrabImage/wmGrabImage.1
new file mode 100644
index 0000000..e8d53e7
--- /dev/null
+++ b/wmgrabimage/wmGrabImage/wmGrabImage.1
@@ -0,0 +1,56 @@
+.TH WMGRABIMGAE 1 "16 December 1998" 
+.SH NAME
+WMGRABIMGAE \- Dockable WWW Image monitor.
+.SH SYNOPSIS
+.B wmGrabImage
+[-h] [-display <Display>] -url <Image URL> [-http <URL>] [-c] [-delay <Time>]
+.SH DESCRIPTION
+.PP
+wmGrabImage is a WindowMaker DockApp that maintains a small thumbnail copy of
+your favorite image from the WWW.  The image to monitor is specified via the
+"-url <Image URL>" command-line option and it gets updated approximately every
+5 minutes.  The update interval can be overridden via the "-delay <Time>"
+command-line option (Time is in seconds).
+.P
+Each of the three mouse buttons can be double clicked with the following 
effects;
+.TP
+.B Left Mouse:
+Brings up the full-sized image in xv.
+.TP
+.B Middle Mouse:
+Sends a URL (specified via the -http <URL> command-line option) to an already
+running netscape process or in a new netscape process if there arent any
+running.
+.TP
+.B Right Mouse:
+Updates the image immediately.
+.SH OPTIONS
+.TP
+.B \-h
+Display list of command-line options.
+.TP
+.B \-display [display]
+Use an alternate X Display.
+.TP
+.B \-url <Image URL>
+The URL of the WWW image to monitor.
+.TP
+.B \-http <URL>
+The URL to send to netscape via a Middle double click.
+.TP
+.B \-c
+Center the image vertically within the icon. 
+.TP
+.B \-delay <Time>
+The time between updates. The default is about 5 minutes.
+.SH FILES
+The original sized image and the thumbnail XPM image are both stored in
+~/.wmGrabImage/ which gets created if it doesnt already exist.
+.SH SEE ALSO
+wget and the ImageMagick convert utility.
+.SH BUGS
+Who knows? -- its still Beta though. (Let me know if you find any). Oldish
+versions of the ImageMagick convert utility have a memory leak -- if you have
+that problem, upgrade to the latest version.
+.SH AUTHOR
+Michael G. Henderson <mghender...@lanl.gov>
diff --git a/wmgrabimage/wmGrabImage/wmGrabImage.c 
b/wmgrabimage/wmGrabImage/wmGrabImage.c
new file mode 100644
index 0000000..01afe8a
--- /dev/null
+++ b/wmgrabimage/wmGrabImage/wmGrabImage.c
@@ -0,0 +1,637 @@
+/*
+ *
+ *     wmGrabImage-1.00 (C) 1999 Mike Henderson (mghender...@lanl.gov)
+ * 
+ *             - Monitors an image on the WWW in a WindowMaker DockApp
+ * 
+ * 
+ * 
+ *
+ *     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
+ *
+ *
+ *     Platforms tested on: Linux, Solaris 2.6, IRIX 6.5
+ *
+ *
+ *     ToDo:   Add inicator to show if image is uptodate or not
+ *             Get rid of GrabImage and put all that stuff in wmGrabImage.c
+ *             Center image in icon - this info should be in the returned 
Attributes struct.
+ *             etc...
+ *
+ *             I am still not sure we are handling color resources properly... 
Seems to work OK on my 24-bit displays...
+ *
+ *
+ *
+ *
+ *      Changes:
+ *     Version 0.72  - May 27, 2001
+ *                     Fixed resource leak (XFreeColors)
+ *
+ *     Version 0.71  - May 24, 2001
+ *                     Added support for "zooming" the icon display 
+ *                     on a region 
+ *
+ *     Version 0.70  - March 28, 1999.
+ *                     Added support for local images (e.g. 
file:///home/mgh/junk.gif.)
+ *
+ *     Version 0.66  - February 23, 1999.
+ *                     Added help line for -delay option. And added a man page.
+ *
+ *     Version 0.65  - February 11, 1999.
+ *                      Now starts netscape if not already running...
+ *
+ *     Version 0.64  - February 9, 1999.
+ *                      Added command-line option for "Time between updates"
+ *
+ *     Version 0.63  - February 9, 1999.
+ *                     Fixed (potential) memory leak in the ShapeMask Pixmap 
+ *                      (gets returned only if color None is used in xpm file)
+ *                     Added XFreeColors call.
+ *
+ *     Version 0.62  - February 4, 1999.
+ *                     buf fixes. Added -c option to center vertically.
+ *
+ *
+ *     Version 0.61  - February 2, 1999.
+ *                     Added Attributes support for Xpm Creation.
+ *                     Also, added a kludge to GrabImage to stream edit
+ *                     any "Transparent" colors that may get generated. 
(Change them
+ *                     to black.)
+ *
+ *     Version 0.6   - February 2, 1999.
+ *                     Some bug fixes. Added Double click support.
+ *                     Now, DoubleClick's do the following:
+ *
+ *                             Button1: display original size image via xv.
+ *
+ *                             Button2: send another URL (specified with the 
-http
+ *                                      command line option) to netscape.
+ * 
+ *                             Button3: Force Update.
+ *
+ *
+ *     Version 0.5   - initial (very) beta release February 1, 1999.
+ *
+ *
+ */
+
+
+
+
+
+/*  
+ *   Includes  
+ */
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <X11/X.h>
+#include <X11/xpm.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "../wmgeneral/wmgeneral.h"
+#include "wmGrabImage_master.xpm"
+#include "wmGrabImage_mask.xbm"
+
+
+
+/* 
+ *  Delay between refreshes (in microseconds) 
+ */
+#define DELAY 10000L
+#define WMGRABIMAGE_VERSION "0.72"
+
+
+
+
+
+void ParseCMDLine(int argc, char *argv[]);
+void pressEvent(XButtonEvent *xev);
+void print_usage();
+
+
+char           ImageURL[1024], XpmFileName[256], ImageFileName[1024];
+char           HttpURL[1024];
+char           *ConvertGeometry= NULL;
+int            UpToDate = 0;
+int            ForceUpdate = 1;
+int            ForceUpdate2 = 1;
+int            GotFirstClick1, GotDoubleClick1;
+int            GotFirstClick2, GotDoubleClick2;
+int            GotFirstClick3, GotDoubleClick3;
+int            DblClkDelay;
+int            CenterImage = 0;
+long int       UpdateDELAY = 600;
+
+
+
+
+
+/*  
+ *   main  
+ */
+int main(int argc, char *argv[]) {
+
+struct tm      *gTime, *gmt;
+struct stat    fi;
+XEvent         event;
+Pixmap         NewPixmap, NewShapeMask;
+XpmAttributes  Attributes;
+Colormap       cmap;
+int            n, s, m, dt1, dt2, dt3, len;
+int            Year, Month, Day;
+int            Hours, Mins, Secs;
+int            i, j, Width, Height, yoff, fd, Flag;
+long           CurrentLocalTime;
+double         UT, hour24(), jd(), CurrentJD, OldFileUT, FileUT;
+char           command[1040], ImageName[256];
+int           havePixmap= 0;
+
+
+
+
+
+
+
+
+
+         
+    /*
+     *  Parse any command line arguments.
+     */
+    ParseCMDLine(argc, argv);
+          
+
+    /*
+     *  Figure out what the name of the image xpm file should be...
+     */
+    len = strlen(ImageURL);
+    for (j = 0, i=0; i<len; ++i){ if (ImageURL[i] == '/') j = i; }
+    strcpy(ImageName, ImageURL+j+1);
+    sprintf(XpmFileName, "%s/.wmGrabImage/%s.xpm", getenv("HOME"), ImageName);
+    sprintf(ImageFileName, "%s/.wmGrabImage/%s", getenv("HOME"), ImageName);
+
+          
+    openXwindow(argc, argv, wmGrabImage_master, wmGrabImage_mask_bits, 
wmGrabImage_mask_width, wmGrabImage_mask_height);
+
+    cmap = DefaultColormap(display, DefaultScreen(display));
+
+
+          
+    /*
+     *  Loop until we die
+     */
+    n = 32000;
+    s = 32000;
+    m = 32000;
+    dt1 = 32000;
+    dt2 = 32000;
+    dt3 = 32000;
+    DblClkDelay = 32000;
+    UpToDate = 0;
+    FileUT = -999.0;
+    Flag = 1;
+    NewShapeMask = 0;
+    Attributes.nalloc_pixels = 0;
+    while(1) {
+
+
+
+
+       /*
+        *  Keep track of # of seconds
+        */
+       if (m > 100){
+       
+           m = 0;
+           ++dt1;
+           ++dt2;
+           ++dt3;
+       
+       } else {
+       
+           /*
+            *  Increment counter
+            */
+           ++m;
+       
+       }
+
+
+
+
+
+
+       /*
+        *  Double Click Delays
+        *  Keep track of click events. If Delay too long, set GotFirstClick's 
to False.
+        */
+       if (DblClkDelay > 15) { 
+
+           DblClkDelay = 0; 
+           GotFirstClick1 = 0; GotDoubleClick1 = 0; 
+           GotFirstClick2 = 0; GotDoubleClick2 = 0; 
+           GotFirstClick3 = 0; GotDoubleClick3 = 0; 
+
+       } else {
+
+           ++DblClkDelay;
+
+       }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+       /* 
+        *   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;
+            }
+        }
+
+
+
+
+
+
+
+
+
+       
+
+
+       /*
+        *  Draw window.
+        */
+       if (ForceUpdate||Flag){
+           
+
+
+            /*
+             *  Compute Current Julian Date
+             */
+            CurrentLocalTime = time(CurrentTime);
+            gTime = gmtime(&CurrentLocalTime);
+            Year  = gTime->tm_year+1900;
+            Month = gTime->tm_mon+1;
+            Day   = gTime->tm_mday;
+            Hours = gTime->tm_hour;
+            Mins  = gTime->tm_min;
+            Secs  = gTime->tm_sec;
+            UT = (double)Hours + (double)Mins/60.0 + (double)Secs/3600.0;
+            CurrentJD = jd(Year, Month, Day, UT);
+
+
+           /*
+            * Clear window.
+            */
+           copyXPMArea(5, 69, 54, 54, 5, 5);
+
+
+
+           if (havePixmap) {
+             /* 
+              * free up the colors, if we alloc'd some before 
+              */
+             if (Attributes.nalloc_pixels > 0) 
+               XFreeColors(display, cmap,  Attributes.alloc_pixels, 
+                           Attributes.nalloc_pixels, 0);
+               /*
+                *  Free last pixmap -- we dont need it anymore...
+                *  A ShapeMask is returned if the Pixmap had the color None 
used.
+                *  We could probably change Transparent to None to make use of 
this, but for now,
+                *  lets just ignore it...
+                */
+               if ( NewShapeMask != 0 ) 
+                 XFreePixmap(display, NewShapeMask);
+               XFreePixmap(display, NewPixmap);
+
+               XpmFreeAttributes(&Attributes);
+
+               havePixmap= 0;
+           }
+           /*
+            *   Grab new pixmap. Accept a reasonable color match.
+            */
+           Attributes.valuemask   = XpmExactColors | XpmCloseness | 
XpmReturnAllocPixels;
+           Attributes.exactColors = 0;
+           Attributes.closeness   = 40000;
+           if (XpmReadFileToPixmap(display, Root, XpmFileName, &NewPixmap, 
&NewShapeMask, &Attributes) >= 0){
+
+
+
+               Height = Attributes.height;
+               Width  = Attributes.width;
+               yoff   = (CenterImage) ? (54 - Height)/2 : 0;
+               XCopyArea(display, NewPixmap, wmgen.pixmap, NormalGC, 0, 0, 
Width, Height, 5, 5+yoff);
+
+
+               Flag = 0;
+               ForceUpdate = 0;
+               havePixmap= 1;
+           }
+
+
+
+
+
+
+           /*
+            * Make changes visible
+            */
+           RedrawWindow();
+
+
+
+       }
+
+
+
+
+
+       /*
+        *  Check xpm file status
+        */
+       if (dt2 > 1){
+
+           dt2 = 0;
+
+           if ( (fd = open(XpmFileName, O_RDONLY)) >= 0 ) {
+
+               fstat(fd, &fi);
+               close(fd);
+               gmt = gmtime(&fi.st_mtime);
+               OldFileUT = FileUT;
+               FileUT = (double)gmt->tm_hour + (double)gmt->tm_min/60.0 + 
(double)gmt->tm_sec/3600.0;
+               if (FileUT != OldFileUT) ForceUpdate = 1;
+
+           }
+
+
+       }
+
+
+
+
+
+
+
+
+
+       /*
+        *  Check every 5 min if the values are not up to date...
+        */
+
+       if (ForceUpdate2||(dt3 > UpdateDELAY)){
+
+           dt3 = 0;
+
+           /*
+            *  Execute Perl script to grab the Latest METAR Report
+            */
+           if (ConvertGeometry != NULL)
+             sprintf(command, "GrabImage %s %s &", ImageURL, ConvertGeometry);
+           else
+             sprintf(command, "GrabImage %s &", ImageURL);
+           system(command);
+
+           ForceUpdate = 1;
+           ForceUpdate2 = 0;
+
+       }
+
+
+
+
+
+       /* 
+        *  Wait for next update 
+        */
+       usleep(DELAY);
+
+
+     }
+
+
+
+}
+
+
+
+/*
+ *   ParseCMDLine()
+ */
+void ParseCMDLine(int argc, char *argv[]) {
+
+    int  i;
+ 
+    ImageURL[0] = '\0';
+    for (i = 1; i < argc; i++) {
+
+        if (!strcmp(argv[i], "-display")){
+
+            ++i;
+
+        } else if ((!strcmp(argv[i], "-url"))||(!strcmp(argv[i], "-u"))){
+
+            strcpy(ImageURL, argv[++i]);
+
+        } else if (!strcmp(argv[i], "-delay")){
+
+            UpdateDELAY = atol(argv[++i]);
+           if (UpdateDELAY < 10){
+               printf("Try a longer delay\n");
+               exit(-1);
+           }
+
+        } else if (!strcmp(argv[i], "-http")){
+
+            strcpy(HttpURL, argv[++i]);
+
+        } else if (!strcmp(argv[i], "-geom")){
+
+            ConvertGeometry= argv[++i];
+
+        } else if (!strcmp(argv[i], "-c")){
+
+            CenterImage = 1;
+
+
+        } else {
+           print_usage();
+            exit(1);
+        }
+    }
+    if (ImageURL[0] == '\0'){
+       fprintf(stderr, "You must specify an Image URL\n");
+       print_usage();
+       exit(-1);
+    }
+
+}
+
+
+void print_usage(){
+
+    printf("\nwmGrabImage version: %s\n", WMGRABIMAGE_VERSION);
+    printf("\nusage: wmGrabImage -u <ImageURL> -http <httpURL> -display 
<Display>] [-h]\n");
+    printf("\t\t[-geom <CroppingGeometry>\n\n");
+    printf("\t-display <Display>\tUse alternate X display.\n");
+    printf("\t-h\t\t\tDisplay help screen.\n");
+    printf("\t-url <ImageURL>\t\tThe URL of image to display.\n\n");
+    printf("\t-delay <Time>\t\tSet time (in seconds) between updates.\n\n");
+    printf("\t-http <httpURL>\t\tThe URL of the WWW page to send 
to\n\t\t\t\tnetscape with Button2 double click.\n\n");
+    printf("\t-c          \tCenter the image vertically in the icon.\n\n");
+    printf("\t-geom <CropGeometry>\tThe geometry to pass to convert\n");
+    printf("\t\t\t\twhen scaling the image..\n\n");
+}
+
+
+
+
+/*
+ *  Compute the Julian Day number for the given date.
+ *  Julian Date is the number of days since noon of Jan 1 4713 B.C.
+ */
+double jd(ny, nm, nd, UT)
+int ny, nm, nd;
+double UT;
+{
+        double A, B, C, D, JD, day;
+
+        day = nd + UT/24.0;
+
+
+        if ((nm == 1) || (nm == 2)){
+                ny = ny - 1;
+                nm = nm + 12;
+        }
+
+        if (((double)ny+nm/12.0+day/365.25)>=(1582.0+10.0/12.0+15.0/365.25)){
+                        A = ((int)(ny / 100.0));
+                        B = 2.0 - A + (int)(A/4.0);
+        }
+        else{
+                        B = 0.0;
+        }
+        if (ny < 0.0){
+                C = (int)((365.25*(double)ny) - 0.75);
+        }
+        else{
+                C = (int)(365.25*(double)ny);
+        }
+
+        D = (int)(30.6001*(double)(nm+1));
+
+
+        JD = B + C + D + day + 1720994.5;
+        return(JD);
+
+}
+
+
+
+/*
+ *  This routine handles button presses. 
+ *
+ *   Double click on 
+ *             Mouse Button 1: Display full size image with xv.
+ *             Mouse Button 2: Send HttpURL to netscape.
+ *             Mouse Button 3: Update image right away (i.e. grab a new one).
+ *
+ *
+ */
+void pressEvent(XButtonEvent *xev){
+
+    char Command[512];
+
+/*
+   ForceUpdate = 1;
+*/
+
+    DblClkDelay = 0;
+    if ((xev->button == Button1) && (xev->type == ButtonPress)){
+       if (GotFirstClick1) GotDoubleClick1 = 1;
+       else GotFirstClick1 = 1;
+    } else if ((xev->button == Button2) && (xev->type == ButtonPress)){ 
+       if (GotFirstClick2) GotDoubleClick2 = 1;
+       else GotFirstClick2 = 1;
+    } else if ((xev->button == Button3) && (xev->type == ButtonPress)){
+       if (GotFirstClick3) GotDoubleClick3 = 1;
+       else GotFirstClick3 = 1;
+    }
+
+
+    /*
+     *  We got a double click on Mouse Button1 (i.e. the left one)
+     */
+    if (GotDoubleClick1) {
+       GotFirstClick1 = 0;
+       GotDoubleClick1 = 0;
+       sprintf(Command, "xv %s &", ImageFileName);
+       system(Command);
+    }
+
+
+    /*
+     *  We got a double click on Mouse Button2 (i.e. the left one)
+     */
+    if (GotDoubleClick2) {
+       GotFirstClick2 = 0;
+       GotDoubleClick2 = 0;
+       sprintf(Command, "netscape -remote 'openURL(%s)' || netscape '%s' &", 
HttpURL, HttpURL);
+       system(Command);
+    }
+
+
+    /*
+     *  We got a double click on Mouse Button3 (i.e. the left one)
+     */
+    if (GotDoubleClick3) {
+       GotFirstClick3 = 0;
+       GotDoubleClick3 = 0;
+       ForceUpdate2 = 1;
+    }
+
+
+
+   return;
+
+}
+
diff --git a/wmgrabimage/wmGrabImage/wmGrabImage_mask.xbm 
b/wmgrabimage/wmGrabImage/wmGrabImage_mask.xbm
new file mode 100644
index 0000000..5befb9d
--- /dev/null
+++ b/wmgrabimage/wmGrabImage/wmGrabImage_mask.xbm
@@ -0,0 +1,38 @@
+#define wmGrabImage_mask_width 64
+#define wmGrabImage_mask_height 64
+static char wmGrabImage_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,
+ 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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00};
diff --git a/wmgrabimage/wmGrabImage/wmGrabImage_master.xpm 
b/wmgrabimage/wmGrabImage/wmGrabImage_master.xpm
new file mode 100644
index 0000000..ec495d6
--- /dev/null
+++ b/wmgrabimage/wmGrabImage/wmGrabImage_master.xpm
@@ -0,0 +1,211 @@
+/* XPM */
+static char *wmGrabImage_master[] = {
+/* width height num_colors chars_per_pixel */
+"    76   128       76            2",
+/* colors */
+".. c #000000",
+".# c #181818",
+".a c #282c38",
+".b c #283038",
+".c c #303040",
+".d c #303440",
+".e c #303840",
+".f c #383848",
+".g c #383c48",
+".h c #384048",
+".i c #404048",
+".j c #404050",
+".k c #404450",
+".l c #404850",
+".m c #484850",
+".n c #484858",
+".o c #484c58",
+".p c #485058",
+".q c #505060",
+".r c #505460",
+".s c #505860",
+".t c #585868",
+".u c #585c68",
+".v c #586068",
+".w c #606068",
+".x c #606070",
+".y c #606470",
+".z c #606870",
+".A c #686870",
+".B c #686878",
+".C c #686c78",
+".D c #687078",
+".E c #707080",
+".F c #707480",
+".G c #707880",
+".H c #787888",
+".I c #787c88",
+".J c #ff0200",
+".K c #788088",
+".L c #79bdbf",
+".M c #ffbf50",
+".N c #808090",
+".O c #808490",
+".P c #808890",
+".Q c #888890",
+".R c #888898",
+".S c #888c98",
+".T c #889098",
+".U c #909098",
+".V c #9090a0",
+".W c #9094a0",
+".X c #9098a0",
+".Y c #9898a8",
+".Z c #989ca8",
+".0 c #98a0a8",
+".1 c #a0a0b0",
+".2 c #a0a4b0",
+".3 c #c8ccd8",
+".4 c #c8d0d8",
+".5 c #d0c4c0",
+".6 c #d0d0d8",
+".7 c #d0d0e0",
+".8 c #d0d4e0",
+".9 c #d0d8e0",
+"#. c #d8d8e0",
+"## c #d8d8e8",
+"#a c #d8dce8",
+"#b c #d8e0e8",
+"#c c #e0e0f0",
+"#d c #e0e4f0",
+"#e c #e0e8f0",
+"#f c #e8e8f8",
+"#g c #e8ecf8",
+"#h c #e8f0f8",
+"#i c #f0f0f8",
+"#j c #f0f4f8",
+/* pixels */
+"#j#j#i#i#i#h#h#h#g#g#g#g#g#g#g#f#f#e#e#e#e#d#d#d#d#d#d#c#c#b#b#b#b#a#a#a#a#a#a#a###..9.9.9.9.8.8.8.8.8.8.7.6.4.4.4.4.4.3.3.3.2..........................",
+"#j#i#i#i#h#h#h#g#g#g#g#g#g#g#f#f#e#e#e#e#d#d#d#d#d#d#c#c#b#b#b#b#a#a#a#a#a#a#a###..9.9.9.9.8.8.8.8.8.8.7.6.4.4.4.4.4.3.3.3.3.r..........................",
+"#i#i.1.1.1.1.0.0.Z.Z.Z.Z.Z.Z.Y.Y.Y.Y.X.X.W.W.W.W.W.W.W.V.V.V.U.T.T.S.S.S.S.S.S.R.R.R.Q.P.P.P.O.O.O.O.O.O.N.N.N.K.K.K.I.I.I.I.r..........................",
+"#i#i.1.1.1.0.0.Z.Z.Z.Z.Z.Z.Y.Y.Y.Y.X.X.W.W.W.W.W.W.W.V.V.V.U.T.T.S.S.S.S.S.S.R.R.R.Q.P.P.P.O.O.O.O.O.O.N.N.N.K.K.K.I.I.I.I.I.r..........................",
+"#i#h.1.1.................................................................................................................I.I.r..........................",
+"#h#h.1.0...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.I.H.r..........................",
+"#h#h.0.0...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.H.H.q..........................",
+"#h#g.0.Z...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.H.H.q..........................",
+"#g#g.Z.Z...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.H.G.q..........................",
+"#g#g.Z.Z...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.G.G.p..........................",
+"#g#g.Z.Z...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.G.G.p..........................",
+"#g#g.Z.Z...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.G.G.p..........................",
+"#g#g.Z.Z...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.G.F.o..........................",
+"#g#g.Z.Y...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.F.F.o..........................",
+"#g#f.Y.Y...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.F.F.o..........................",
+"#f#f.Y.Y...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.F.F.o..........................",
+"#f#e.Y.Y...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.F.F.o..........................",
+"#e#e.Y.X...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.F.F.o..........................",
+"#e#e.X.X...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.F.E.n..........................",
+"#e#e.X.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.E.E.n..........................",
+"#e#d.W.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.E.D.n..........................",
+"#d#d.W.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.D.D.m..........................",
+"#d#d.W.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.D.D.l..........................",
+"#d#d.W.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.D.D.l..........................",
+"#d#d.W.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.D.C.l..........................",
+"#d#d.W.W...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.C.C.k..........................",
+"#d#c.W.V...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.C.C.k..........................",
+"#c#c.V.V...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.C.C.k..........................",
+"#c#b.V.V...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.C.C.k..........................",
+"#b#b.V.U...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.C.C.k..........................",
+"#b#b.U.T...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.C.B.k..........................",
+"#b#b.T.T...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.B.B.j..........................",
+"#b#a.T.S...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.B.A.j..........................",
+"#a#a.S.S...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.A.A.i..........................",
+"#a#a.S.S...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.A.z.h..........................",
+"#a#a.S.S...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.z.z.h..........................",
+"#a#a.S.S...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.z.z.h..........................",
+"#a#a.S.S...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.z.y.g..........................",
+"#a#a.S.R...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.y.y.g..........................",
+"#a##.R.R...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.y.y.g..........................",
+"###..R.R...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.y.y.g..........................",
+"#..9.R.Q...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.y.y.g..........................",
+".9.9.Q.P...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.y.y.g..........................",
+".9.9.P.P...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.y.x.g..........................",
+".9.9.P.P...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.x.w.f..........................",
+".9.8.P.O...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.w.w.f..........................",
+".8.8.O.O...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.w.v.e..........................",
+".8.8.O.O...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.v.v.e..........................",
+".8.8.O.O...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.v.v.e..........................",
+".8.8.O.O...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.v.u.e..........................",
+".8.8.O.O...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.u.d..........................",
+".8.7.O.N...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.u.d..........................",
+".7.6.N.N...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.u.d..........................",
+".6.4.N.N...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.u.d..........................",
+".4.4.N.K...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.u.d..........................",
+".4.4.K.K...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.u.d..........................",
+".4.4.K.K...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.u.t.c..........................",
+".4.4.K.I...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.t.t.c..........................",
+".4.3.I.I...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.5.t.s.b..........................",
+".3.3.I.I.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.s.s.b..........................",
+".3.3.I.I.I.I.H.H.H.G.G.G.G.F.F.F.F.F.F.E.E.D.D.D.D.C.C.C.C.C.C.B.B.A.A.z.z.z.y.y.y.y.y.y.x.w.w.v.v.v.u.u.u.u.u.u.u.t.t.s.s.s.b..........................",
+".3.3.I.I.I.H.H.H.G.G.G.G.F.F.F.F.F.F.E.E.D.D.D.D.C.C.C.C.C.C.B.B.A.A.z.z.z.y.y.y.y.y.y.x.w.w.v.v.v.u.u.u.u.u.u.u.t.t.s.s.s.s.b..........................",
+".2.r.r.r.r.r.q.q.q.p.p.p.o.o.o.o.o.o.n.n.n.m.l.l.l.k.k.k.k.k.k.j.j.i.h.h.h.g.g.g.g.g.g.g.f.f.e.e.e.e.d.d.d.d.d.d.c.c.b.b.b.b.a..........................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"...........#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................",
+"........................................................................................................................................................"
+};
diff --git a/wmgrabimage/wmgeneral/wmgeneral.c 
b/wmgrabimage/wmgeneral/wmgeneral.c
new file mode 100644
index 0000000..c251fa2
--- /dev/null
+++ b/wmgrabimage/wmgeneral/wmgeneral.c
@@ -0,0 +1,363 @@
+/*
+       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 */
+/*****************/
+
+int                    screen;
+int                    x_fd;
+int                    d_depth;
+XSizeHints     mysizehints;
+XWMHints       mywmhints;
+Pixel          back_pix, fore_pix;
+char           *Geometry = "";
+Window         iconwin, win;
+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/wmgrabimage/wmgeneral/wmgeneral.h 
b/wmgrabimage/wmgeneral/wmgeneral.h
new file mode 100644
index 0000000..c7c19c3
--- /dev/null
+++ b/wmgrabimage/wmgeneral/wmgeneral.h
@@ -0,0 +1,54 @@
+#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;
+Window          Root;
+GC              NormalGC;
+XpmIcon         wmgen;
+
+
+  /***********************/
+ /* 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.7.4


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

Reply via email to