This patch includes the library wmgeneral. The wmgeneral library
is used in a lot of dockapps:

$ find . -name wmgeneral
./wmkeys/wmgeneral
./wmtime/wmgeneral
./wmtz/wmgeneral
./wmsm.app/wmgeneral
./wmcpufreq/wmgeneral
./wmtv/src/wmgeneral
./wmSMPmon/wmgeneral
./wmckgmail/wmgeneral
./wmifs/wmgeneral
./wmbiff/wmgeneral
./wmfsm/wmgeneral
./wmsun/wmgeneral
./wmmon/wmgeneral
./wmitime/wmgeneral
./wmppp.app/wmgeneral

So, any change in the wmgeneral needs change a lot of dockapps.

I used the wmmon dockapp to move the wmgeneral and then I adjust the
wmmon to use the library. The library must be installed in the system
to build wmmon (wmmon uses the .h files) and is needed to run wmmon
(wmmon uses the libwmgeneral.so shared library).

I did not include any Changelog/README/... file to announce the change
in the libwmgeneral folder.

Signed-off-by: Rodolfo García Peñas (kix) <k...@kix.es>
---
 libwmgeneral/Makefile       |  37 ++++
 libwmgeneral/list.c         | 169 +++++++++++++++
 libwmgeneral/list.h         |  53 +++++
 libwmgeneral/misc.c         | 172 +++++++++++++++
 libwmgeneral/misc.h         |  31 +++
 libwmgeneral/wmgeneral.c    | 494 ++++++++++++++++++++++++++++++++++++++++++++
 libwmgeneral/wmgeneral.h    |  89 ++++++++
 wmmon/wmgeneral/list.c      | 169 ---------------
 wmmon/wmgeneral/list.h      |  53 -----
 wmmon/wmgeneral/misc.c      | 172 ---------------
 wmmon/wmgeneral/misc.h      |  31 ---
 wmmon/wmgeneral/wmgeneral.c | 494 --------------------------------------------
 wmmon/wmgeneral/wmgeneral.h |  89 --------
 wmmon/wmmon/Makefile        |  10 +-
 wmmon/wmmon/wmmon.c         |   4 +-
 15 files changed, 1050 insertions(+), 1017 deletions(-)
 create mode 100644 libwmgeneral/Makefile
 create mode 100644 libwmgeneral/list.c
 create mode 100644 libwmgeneral/list.h
 create mode 100644 libwmgeneral/misc.c
 create mode 100644 libwmgeneral/misc.h
 create mode 100644 libwmgeneral/wmgeneral.c
 create mode 100644 libwmgeneral/wmgeneral.h
 delete mode 100644 wmmon/wmgeneral/list.c
 delete mode 100644 wmmon/wmgeneral/list.h
 delete mode 100644 wmmon/wmgeneral/misc.c
 delete mode 100644 wmmon/wmgeneral/misc.h
 delete mode 100644 wmmon/wmgeneral/wmgeneral.c
 delete mode 100644 wmmon/wmgeneral/wmgeneral.h
 mode change 100755 => 100644 wmmon/wmmon/Makefile

diff --git a/libwmgeneral/Makefile b/libwmgeneral/Makefile
new file mode 100644
index 0000000..d52a335
--- /dev/null
+++ b/libwmgeneral/Makefile
@@ -0,0 +1,37 @@
+PREFIX = /usr/local
+DESTDIR = $(PREFIX)/lib
+INCDIR = $(PREFIX)/include/wmgeneral
+LIBDIR = -L/usr/X11R6/lib
+LIBS   = -lXpm -lXext -lX11
+TARGET = libwmgeneral.so
+OBJECTS =  wmgeneral.o \
+       misc.o \
+       list.o
+HEADERS = wmgeneral.h \
+       list.h \
+       misc.h
+
+INSTALL = install
+INSTALL_LIB = $(INSTALL)
+
+CFLAGS = -O2 -c -Wall -Werror -fpic
+LDFLAGS = -shared
+CC = cc
+
+.c.o::
+       $(CC) $(CFLAGS) $< -o $*.o
+
+$(TARGET):: $(OBJECTS)
+       $(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS)
+
+clean::
+       for i in $(OBJECTS) ; do \
+               rm -f $$i;\
+       done
+       rm -f $(TARGET)
+
+install:: $(TARGET)
+       $(INSTALL) -d $(DESTDIR)
+       $(INSTALL) -m 644 $(TARGET) $(DESTDIR)
+       $(INSTALL) -d $(INCDIR)
+       $(INSTALL) -m 644 $(HEADERS) $(INCDIR)
diff --git a/libwmgeneral/list.c b/libwmgeneral/list.c
new file mode 100644
index 0000000..0b69885
--- /dev/null
+++ b/libwmgeneral/list.c
@@ -0,0 +1,169 @@
+/* Generic single linked list to keep various information
+   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+
+Author: Kresten Krab Thorup
+
+Many modifications by Alfredo K. Kojima
+
+
+This file is part of GNU CC.
+
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301 USA.  */
+
+/* As a special exception, if you link this library with files compiled with
+   GCC to produce an executable, this does not cause the resulting executable
+   to be covered by the GNU General Public License. This exception does not
+   however invalidate any other reasons why the executable file might be
+   covered by the GNU General Public License.  */
+
+#include "list.h"
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <stdlib.h>
+
+/* Return a cons cell produced from (head . tail) */
+
+LinkedList*
+list_cons(void* head, LinkedList* tail)
+{
+  LinkedList* cell;
+
+  cell = (LinkedList*)malloc(sizeof(LinkedList));
+  cell->head = head;
+  cell->tail = tail;
+  return cell;
+}
+
+/* Return the length of a list, list_length(NULL) returns zero */
+
+int
+list_length(LinkedList* list)
+{
+  int i = 0;
+  while(list)
+    {
+      i += 1;
+      list = list->tail;
+    }
+  return i;
+}
+
+/* Return the Nth element of LIST, where N count from zero.  If N
+   larger than the list length, NULL is returned  */
+
+void*
+list_nth(int index, LinkedList* list)
+{
+  while(index-- != 0)
+    {
+      if(list->tail)
+       list = list->tail;
+      else
+       return 0;
+    }
+  return list->head;
+}
+
+/* Remove the element at the head by replacing it by its successor */
+
+void
+list_remove_head(LinkedList** list)
+{
+  if (!*list) return;
+  if ((*list)->tail)
+    {
+      LinkedList* tail = (*list)->tail; /* fetch next */
+      *(*list) = *tail;                /* copy next to list head */
+      free(tail);                      /* free next */
+    }
+  else                         /* only one element in list */
+    {
+      free(*list);
+      (*list) = 0;
+    }
+}
+
+
+/* Remove the element with `car' set to ELEMENT */
+/*
+void
+list_remove_elem(LinkedList** list, void* elem)
+{
+  while (*list)
+    {
+      if ((*list)->head == elem)
+        list_remove_head(list);
+      *list = (*list ? (*list)->tail : NULL);
+    }
+}*/
+
+LinkedList *
+list_remove_elem(LinkedList* list, void* elem)
+{
+    LinkedList *tmp;
+
+    if (list) {
+       if (list->head == elem) {
+           tmp = list->tail;
+           free(list);
+           return tmp;
+       }
+       list->tail = list_remove_elem(list->tail, elem);
+       return list;
+    }
+    return NULL;
+}
+
+
+/* Return element that has ELEM as car */
+
+LinkedList*
+list_find(LinkedList* list, void* elem)
+{
+  while(list)
+    {
+    if (list->head == elem)
+      return list;
+    list = list->tail;
+    }
+  return NULL;
+}
+
+/* Free list (backwards recursive) */
+
+void
+list_free(LinkedList* list)
+{
+  if(list)
+    {
+      list_free(list->tail);
+      free(list);
+    }
+}
+
+/* Map FUNCTION over all elements in LIST */
+
+void
+list_mapcar(LinkedList* list, void(*function)(void*))
+{
+  while(list)
+    {
+      (*function)(list->head);
+      list = list->tail;
+    }
+}
diff --git a/libwmgeneral/list.h b/libwmgeneral/list.h
new file mode 100644
index 0000000..3d6bad5
--- /dev/null
+++ b/libwmgeneral/list.h
@@ -0,0 +1,53 @@
+/* Generic single linked list to keep various information
+   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+Author: Kresten Krab Thorup
+
+This file is part of GNU CC.
+
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301 USA.  */
+
+/* As a special exception, if you link this library with files compiled with
+   GCC to produce an executable, this does not cause the resulting executable
+   to be covered by the GNU General Public License. This exception does not
+   however invalidate any other reasons why the executable file might be
+   covered by the GNU General Public License.  */
+
+#ifndef __LIST_H_
+#define __LIST_H_
+
+typedef struct LinkedList {
+  void *head;
+  struct LinkedList *tail;
+} LinkedList;
+
+LinkedList* list_cons(void* head, LinkedList* tail);
+
+int list_length(LinkedList* list);
+
+void* list_nth(int index, LinkedList* list);
+
+void list_remove_head(LinkedList** list);
+
+LinkedList *list_remove_elem(LinkedList* list, void* elem);
+
+void list_mapcar(LinkedList* list, void(*function)(void*));
+
+LinkedList*list_find(LinkedList* list, void* elem);
+
+void list_free(LinkedList* list);
+
+#endif
diff --git a/libwmgeneral/misc.c b/libwmgeneral/misc.c
new file mode 100644
index 0000000..fb36fd1
--- /dev/null
+++ b/libwmgeneral/misc.c
@@ -0,0 +1,172 @@
+/*  wmgeneral miscellaneous functions
+ *
+ *  from dock.c - built-in Dock module for WindowMaker window manager
+ *
+ *  Copyright (c) 1997 Alfredo K. Kojima
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ *  USA.
+ */
+
+#define _POSIX_C_SOURCE 200809L
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "list.h"
+#include "misc.h"
+
+/*
+ *----------------------------------------------------------------------
+ * parse_command--
+ *     Divides a command line into a argv/argc pair.
+ *----------------------------------------------------------------------
+ */
+#define PRC_ALPHA      0
+#define PRC_BLANK      1
+#define PRC_ESCAPE     2
+#define PRC_DQUOTE     3
+#define PRC_EOS                4
+#define PRC_SQUOTE     5
+
+typedef struct {
+    short nstate;
+    short output;
+} DFA;
+
+
+static DFA mtable[9][6] = {
+    {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
+    {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
+    {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
+    {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
+    {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
+    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+    {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
+    {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
+    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+};
+
+char*
+next_token(char *word, char **next)
+{
+    char *ptr;
+    char *ret, *t;
+    int state, ctype;
+
+    t = ret = malloc(strlen(word)+1);
+    if (ret == NULL) {
+           fprintf(stderr, "Insufficient memory.\n");
+           exit(EXIT_FAILURE);
+    }
+    ptr = word;
+
+    state = 0;
+    *t = 0;
+    while (1) {
+       if (*ptr==0)
+           ctype = PRC_EOS;
+       else if (*ptr=='\\')
+           ctype = PRC_ESCAPE;
+       else if (*ptr=='"')
+           ctype = PRC_DQUOTE;
+       else if (*ptr=='\'')
+           ctype = PRC_SQUOTE;
+       else if (*ptr==' ' || *ptr=='\t')
+           ctype = PRC_BLANK;
+       else
+           ctype = PRC_ALPHA;
+
+       if (mtable[state][ctype].output) {
+           *t = *ptr; t++;
+           *t = 0;
+       }
+       state = mtable[state][ctype].nstate;
+       ptr++;
+       if (mtable[state][0].output<0) {
+           break;
+       }
+    }
+
+    if (*ret==0)
+       t = NULL;
+    else
+       t = strdup(ret);
+
+    free(ret);
+
+    if (ctype==PRC_EOS)
+       *next = NULL;
+    else
+       *next = ptr;
+
+    return t;
+}
+
+
+extern void
+parse_command(char *command, char ***argv, int *argc)
+{
+    LinkedList *list = NULL;
+    char *token, *line;
+    int count, i;
+
+    line = command;
+    do {
+       token = next_token(line, &line);
+       if (token) {
+           list = list_cons(token, list);
+       }
+    } while (token!=NULL && line!=NULL);
+
+    count = list_length(list);
+    *argv = malloc(sizeof(char*)*count);
+    i = count;
+    while (list!=NULL) {
+       (*argv)[--i] = list->head;
+       list_remove_head(&list);
+    }
+    *argc = count;
+}
+
+extern pid_t
+execCommand(char *command)
+{
+    pid_t pid;
+    char **argv;
+    int argc;
+
+    parse_command(command, &argv, &argc);
+
+    if (argv==NULL) {
+        return 0;
+    }
+
+    if ((pid=fork())==0) {
+        char **args;
+        int i;
+
+        args = malloc(sizeof(char*)*(argc+1));
+        if (!args)
+          exit(10);
+        for (i=0; i<argc; i++) {
+            args[i] = argv[i];
+        }
+        args[argc] = NULL;
+        execvp(argv[0], args);
+        exit(10);
+    }
+    free(argv);
+    return pid;
+}
diff --git a/libwmgeneral/misc.h b/libwmgeneral/misc.h
new file mode 100644
index 0000000..830b765
--- /dev/null
+++ b/libwmgeneral/misc.h
@@ -0,0 +1,31 @@
+/*  wmgeneral miscellaneous functions
+ *
+ *  from dock.c - built-in Dock module for WindowMaker window manager
+ *
+ *  Copyright (c) 1997 Alfredo K. Kojima
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ *  USA.
+ */
+
+#ifndef __MISC_H
+#define __MISC_H
+
+#include <unistd.h>
+
+extern void parse_command(char *, char ***, int *);
+
+extern pid_t execCommand(char *);
+#endif /* __MISC_H */
diff --git a/libwmgeneral/wmgeneral.c b/libwmgeneral/wmgeneral.c
new file mode 100644
index 0000000..c624193
--- /dev/null
+++ b/libwmgeneral/wmgeneral.c
@@ -0,0 +1,494 @@
+/*
+       wmgeneral was taken from wmppp.
+
+       It has a lot of routines which most of the wm* programs use.
+
+       ------------------------------------------------------------
+
+       Copyright (C) 1998 Martijn Pieterse (piete...@xs4all.nl)
+
+       This program is free software; you can redistribute it and/or
+       modify it under the terms of the GNU General Public License
+       as published by the Free Software Foundation; either version 2
+       of the License, or (at your option) any later version.
+
+       This program is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       GNU General Public License for more details.
+
+       You should have received a copy of the GNU General Public License
+       along with this program; if not, write to the Free Software
+       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+       02110-1301, USA.
+
+       ---
+       CHANGES:
+       ---
+       10/10/2003 (Simon Law, sfl...@debian.org)
+               * changed the parse_rcfile function to use getline instead of
+                 fgets.
+       10/14/2000 (Chris Gray, cg...@tribsoft.com)
+               * Removed a bug from parse_rcfile.  An extra
+                 newline would cause a segfault.
+       14/09/1998 (Dave Clark, cla...@skyia.com)
+               * Updated createXBMfromXPM routine
+               * Now supports >256 colors
+       11/09/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * Removed a bug from parse_rcfile. You could
+                 not use "start" in a command if a label was
+                 also start.
+               * Changed the needed geometry string.
+                 We don't use window size, and don't support
+                 negative positions.
+       03/09/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * Added parse_rcfile2
+       02/09/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * Added -geometry support (untested)
+       28/08/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * Added createXBMfromXPM routine
+               * Saves a lot of work with changing xpm's.
+       02/05/1998 (Martijn Pieterse, piete...@xs4all.nl)
+               * changed the read_rc_file to parse_rcfile, as suggested 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.
+
+*/
+
+#define _POSIX_C_SOURCE 200809L
+#include "wmgeneral.h"
+#include <X11/Xlib.h>                   /* for XCopyArea, etc */
+#include <X11/Xutil.h>                  /* for XSizeHints, XWMHints, etc */
+#include <X11/extensions/shape.h>       /* for XShapeCombineMask */
+#include <X11/extensions/shapeconst.h>  /* for ShapeBounding, ShapeSet */
+#include <X11/xpm.h>                    /* for XpmAttributes, Pixel, etc */
+#include <stddef.h>                     /* for size_t */
+#include <stdio.h>                      /* for fprintf, stderr, NULL, etc */
+#include <stdlib.h>                     /* for exit, free */
+#include <string.h>                     /* for strcmp, strdup, strcspn, etc */
+
+  /*****************/
+ /* X11 Variables */
+/*****************/
+
+Window         Root;
+int                    screen;
+int                    x_fd;
+int                    d_depth;
+XSizeHints     mysizehints;
+XWMHints       mywmhints;
+Pixel          back_pix, fore_pix;
+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;
+
+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);
+
+/*******************************************************************************\
+|* parse_rcfile                                                                
                                                                   *|
+\*******************************************************************************/
+
+void parse_rcfile(const char *filename, rckeys *keys) {
+
+       char    *p;
+       FILE    *fp;
+
+       fp = fopen(filename, "r");
+       if (fp) {
+               char temp[128];
+
+               while (fgets(temp, 128, fp)) {
+                       char *q, *saveptr;
+                       char *tokens = " :\t\n";
+                       int key;
+
+                       key = 0;
+                       q = strdup(temp);
+                       q = strtok_r(q, tokens, &saveptr);
+                       if(!q)
+                               continue;
+                       while (key >= 0 && keys[key].label) {
+                               if ((!strcmp(q, keys[key].label))) {
+                                       int i;
+
+                                       p = strstr(temp, keys[key].label);
+                                       p += strlen(keys[key].label);
+                                       p += strspn(p, tokens);
+                                       if ((i = strcspn(p, "#\n"))) p[i] = 
'\0';
+                                       *keys[key].var = strdup(p);
+                                       key = -1;
+                               } else key++;
+                       }
+               }
+               fclose(fp);
+       }
+}
+
+/*******************************************************************************\
+|* parse_rcfile2                                                               
                                                           *|
+\*******************************************************************************/
+
+void parse_rcfile2(const char *filename, rckeys2 *keys) {
+
+       char    *p;
+       char    *line = NULL;
+       size_t  line_size = 0;
+       FILE    *fp;
+
+       fp = fopen(filename, "r");
+       if (fp) {
+               while (getline(&line, &line_size, fp) >= 0) {
+                       int key;
+
+                       key = 0;
+                       while (key >= 0 && keys[key].label) {
+                               if ((p = strstr(line, keys[key].label))) {
+                                       char *tokens = " :\t\n";
+                                       int i;
+
+                                       p += strlen(keys[key].label);
+                                       p += strspn(p, tokens);
+                                       if ((i = strcspn(p, "#\n"))) p[i] = 0;
+                                       *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);
+}
+
+/*******************************************************************************\
+|* createXBMfromXPM                                                            
                                                           *|
+\*******************************************************************************/
+void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
+
+       int     i,j,k;
+       int     width, height, numcol, depth;
+       int     zero=0;
+       int     curpixel;
+
+       sscanf(*xpm, "%10d %10d %10d %10d", &width, &height, &numcol, &depth);
+
+
+       for (k=0; k!=depth; k++)
+       {
+               zero <<=8;
+               zero |= xpm[1][k];
+       }
+
+       for (i=numcol+1; i < numcol+sy+1; i++) {
+               unsigned char bwrite;
+               int bcount;
+
+               bcount = 0;
+               bwrite = 0;
+               for (j=0; j<sx*depth; j+=depth) {
+                       bwrite >>= 1;
+
+                       curpixel=0;
+                       for (k=0; k!=depth; k++)
+                       {
+                               curpixel <<=8;
+                               curpixel |= xpm[i][j+k];
+                       }
+
+                       if ( curpixel != zero ) {
+                               bwrite += 128;
+                       }
+                       bcount++;
+                       if (bcount == 8) {
+                               *xbm = bwrite;
+                               xbm++;
+                               bcount = 0;
+                               bwrite = 0;
+                       }
+               }
+       }
+}
+
+/*******************************************************************************\
+|* 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;
+
+       char                    *geometry = NULL;
+
+       int                             dummy=0;
+       int                             i;
+
+       for (i=1; argv[i]; i++) {
+               if (!strcmp(argv[i], "-display"))
+                       display_name = argv[++i];
+               else if (!strcmp(argv[i], "-geometry"))
+                       geometry = argv[++i];
+       }
+
+       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/libwmgeneral/wmgeneral.h b/libwmgeneral/wmgeneral.h
new file mode 100644
index 0000000..c3454c5
--- /dev/null
+++ b/libwmgeneral/wmgeneral.h
@@ -0,0 +1,89 @@
+/*
+       wmgeneral was taken from wmppp.
+
+       It has a lot of routines which most of the wm* programs use.
+
+       ------------------------------------------------------------
+
+       Copyright (C) 1998 Martijn Pieterse (piete...@xs4all.nl)
+
+       This program is free software; you can redistribute it and/or
+       modify it under the terms of the GNU General Public License
+       as published by the Free Software Foundation; either version 2
+       of the License, or (at your option) any later version.
+
+       This program is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       GNU General Public License for more details.
+
+       You should have received a copy of the GNU General Public License
+       along with this program; if not, write to the Free Software
+       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+       02110-1301, USA.
+
+*/
+
+#ifndef WMGENERAL_H_INCLUDED
+#define WMGENERAL_H_INCLUDED
+
+#include <X11/X.h>                      /* for Pixmap */
+#include <X11/Xlib.h>                   /* for Display */
+#include <X11/xpm.h>                    /* for XpmAttributes */
+
+  /***********/
+ /* Defines */
+/***********/
+
+#define MAX_MOUSE_REGION (16)
+
+  /************/
+ /* Typedefs */
+/************/
+
+struct _rckeys {
+       const char      *label;
+       char            **var;
+};
+
+typedef struct _rckeys rckeys;
+
+struct _rckeys2 {
+       const char      *family;
+       const char      *label;
+       char            **var;
+};
+
+typedef struct _rckeys2 rckeys2;
+
+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 createXBMfromXPM(char *, char **, int, int);
+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
diff --git a/wmmon/wmgeneral/list.c b/wmmon/wmgeneral/list.c
deleted file mode 100644
index 0b69885..0000000
--- a/wmmon/wmgeneral/list.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Generic single linked list to keep various information
-   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-
-
-Author: Kresten Krab Thorup
-
-Many modifications by Alfredo K. Kojima
-
-
-This file is part of GNU CC.
-
-GNU CC 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.
-
-GNU CC 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 GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301 USA.  */
-
-/* As a special exception, if you link this library with files compiled with
-   GCC to produce an executable, this does not cause the resulting executable
-   to be covered by the GNU General Public License. This exception does not
-   however invalidate any other reasons why the executable file might be
-   covered by the GNU General Public License.  */
-
-#include "list.h"
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#include <stdlib.h>
-
-/* Return a cons cell produced from (head . tail) */
-
-LinkedList*
-list_cons(void* head, LinkedList* tail)
-{
-  LinkedList* cell;
-
-  cell = (LinkedList*)malloc(sizeof(LinkedList));
-  cell->head = head;
-  cell->tail = tail;
-  return cell;
-}
-
-/* Return the length of a list, list_length(NULL) returns zero */
-
-int
-list_length(LinkedList* list)
-{
-  int i = 0;
-  while(list)
-    {
-      i += 1;
-      list = list->tail;
-    }
-  return i;
-}
-
-/* Return the Nth element of LIST, where N count from zero.  If N
-   larger than the list length, NULL is returned  */
-
-void*
-list_nth(int index, LinkedList* list)
-{
-  while(index-- != 0)
-    {
-      if(list->tail)
-       list = list->tail;
-      else
-       return 0;
-    }
-  return list->head;
-}
-
-/* Remove the element at the head by replacing it by its successor */
-
-void
-list_remove_head(LinkedList** list)
-{
-  if (!*list) return;
-  if ((*list)->tail)
-    {
-      LinkedList* tail = (*list)->tail; /* fetch next */
-      *(*list) = *tail;                /* copy next to list head */
-      free(tail);                      /* free next */
-    }
-  else                         /* only one element in list */
-    {
-      free(*list);
-      (*list) = 0;
-    }
-}
-
-
-/* Remove the element with `car' set to ELEMENT */
-/*
-void
-list_remove_elem(LinkedList** list, void* elem)
-{
-  while (*list)
-    {
-      if ((*list)->head == elem)
-        list_remove_head(list);
-      *list = (*list ? (*list)->tail : NULL);
-    }
-}*/
-
-LinkedList *
-list_remove_elem(LinkedList* list, void* elem)
-{
-    LinkedList *tmp;
-
-    if (list) {
-       if (list->head == elem) {
-           tmp = list->tail;
-           free(list);
-           return tmp;
-       }
-       list->tail = list_remove_elem(list->tail, elem);
-       return list;
-    }
-    return NULL;
-}
-
-
-/* Return element that has ELEM as car */
-
-LinkedList*
-list_find(LinkedList* list, void* elem)
-{
-  while(list)
-    {
-    if (list->head == elem)
-      return list;
-    list = list->tail;
-    }
-  return NULL;
-}
-
-/* Free list (backwards recursive) */
-
-void
-list_free(LinkedList* list)
-{
-  if(list)
-    {
-      list_free(list->tail);
-      free(list);
-    }
-}
-
-/* Map FUNCTION over all elements in LIST */
-
-void
-list_mapcar(LinkedList* list, void(*function)(void*))
-{
-  while(list)
-    {
-      (*function)(list->head);
-      list = list->tail;
-    }
-}
diff --git a/wmmon/wmgeneral/list.h b/wmmon/wmgeneral/list.h
deleted file mode 100644
index 3d6bad5..0000000
--- a/wmmon/wmgeneral/list.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Generic single linked list to keep various information
-   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-
-Author: Kresten Krab Thorup
-
-This file is part of GNU CC.
-
-GNU CC 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.
-
-GNU CC 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 GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301 USA.  */
-
-/* As a special exception, if you link this library with files compiled with
-   GCC to produce an executable, this does not cause the resulting executable
-   to be covered by the GNU General Public License. This exception does not
-   however invalidate any other reasons why the executable file might be
-   covered by the GNU General Public License.  */
-
-#ifndef __LIST_H_
-#define __LIST_H_
-
-typedef struct LinkedList {
-  void *head;
-  struct LinkedList *tail;
-} LinkedList;
-
-LinkedList* list_cons(void* head, LinkedList* tail);
-
-int list_length(LinkedList* list);
-
-void* list_nth(int index, LinkedList* list);
-
-void list_remove_head(LinkedList** list);
-
-LinkedList *list_remove_elem(LinkedList* list, void* elem);
-
-void list_mapcar(LinkedList* list, void(*function)(void*));
-
-LinkedList*list_find(LinkedList* list, void* elem);
-
-void list_free(LinkedList* list);
-
-#endif
diff --git a/wmmon/wmgeneral/misc.c b/wmmon/wmgeneral/misc.c
deleted file mode 100644
index fb36fd1..0000000
--- a/wmmon/wmgeneral/misc.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*  wmgeneral miscellaneous functions
- *
- *  from dock.c - built-in Dock module for WindowMaker window manager
- *
- *  Copyright (c) 1997 Alfredo K. Kojima
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- *  USA.
- */
-
-#define _POSIX_C_SOURCE 200809L
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "list.h"
-#include "misc.h"
-
-/*
- *----------------------------------------------------------------------
- * parse_command--
- *     Divides a command line into a argv/argc pair.
- *----------------------------------------------------------------------
- */
-#define PRC_ALPHA      0
-#define PRC_BLANK      1
-#define PRC_ESCAPE     2
-#define PRC_DQUOTE     3
-#define PRC_EOS                4
-#define PRC_SQUOTE     5
-
-typedef struct {
-    short nstate;
-    short output;
-} DFA;
-
-
-static DFA mtable[9][6] = {
-    {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
-    {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
-    {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
-    {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
-    {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
-    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
-    {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
-    {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
-    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
-};
-
-char*
-next_token(char *word, char **next)
-{
-    char *ptr;
-    char *ret, *t;
-    int state, ctype;
-
-    t = ret = malloc(strlen(word)+1);
-    if (ret == NULL) {
-           fprintf(stderr, "Insufficient memory.\n");
-           exit(EXIT_FAILURE);
-    }
-    ptr = word;
-
-    state = 0;
-    *t = 0;
-    while (1) {
-       if (*ptr==0)
-           ctype = PRC_EOS;
-       else if (*ptr=='\\')
-           ctype = PRC_ESCAPE;
-       else if (*ptr=='"')
-           ctype = PRC_DQUOTE;
-       else if (*ptr=='\'')
-           ctype = PRC_SQUOTE;
-       else if (*ptr==' ' || *ptr=='\t')
-           ctype = PRC_BLANK;
-       else
-           ctype = PRC_ALPHA;
-
-       if (mtable[state][ctype].output) {
-           *t = *ptr; t++;
-           *t = 0;
-       }
-       state = mtable[state][ctype].nstate;
-       ptr++;
-       if (mtable[state][0].output<0) {
-           break;
-       }
-    }
-
-    if (*ret==0)
-       t = NULL;
-    else
-       t = strdup(ret);
-
-    free(ret);
-
-    if (ctype==PRC_EOS)
-       *next = NULL;
-    else
-       *next = ptr;
-
-    return t;
-}
-
-
-extern void
-parse_command(char *command, char ***argv, int *argc)
-{
-    LinkedList *list = NULL;
-    char *token, *line;
-    int count, i;
-
-    line = command;
-    do {
-       token = next_token(line, &line);
-       if (token) {
-           list = list_cons(token, list);
-       }
-    } while (token!=NULL && line!=NULL);
-
-    count = list_length(list);
-    *argv = malloc(sizeof(char*)*count);
-    i = count;
-    while (list!=NULL) {
-       (*argv)[--i] = list->head;
-       list_remove_head(&list);
-    }
-    *argc = count;
-}
-
-extern pid_t
-execCommand(char *command)
-{
-    pid_t pid;
-    char **argv;
-    int argc;
-
-    parse_command(command, &argv, &argc);
-
-    if (argv==NULL) {
-        return 0;
-    }
-
-    if ((pid=fork())==0) {
-        char **args;
-        int i;
-
-        args = malloc(sizeof(char*)*(argc+1));
-        if (!args)
-          exit(10);
-        for (i=0; i<argc; i++) {
-            args[i] = argv[i];
-        }
-        args[argc] = NULL;
-        execvp(argv[0], args);
-        exit(10);
-    }
-    free(argv);
-    return pid;
-}
diff --git a/wmmon/wmgeneral/misc.h b/wmmon/wmgeneral/misc.h
deleted file mode 100644
index 830b765..0000000
--- a/wmmon/wmgeneral/misc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*  wmgeneral miscellaneous functions
- *
- *  from dock.c - built-in Dock module for WindowMaker window manager
- *
- *  Copyright (c) 1997 Alfredo K. Kojima
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- *  USA.
- */
-
-#ifndef __MISC_H
-#define __MISC_H
-
-#include <unistd.h>
-
-extern void parse_command(char *, char ***, int *);
-
-extern pid_t execCommand(char *);
-#endif /* __MISC_H */
diff --git a/wmmon/wmgeneral/wmgeneral.c b/wmmon/wmgeneral/wmgeneral.c
deleted file mode 100644
index c624193..0000000
--- a/wmmon/wmgeneral/wmgeneral.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
-       wmgeneral was taken from wmppp.
-
-       It has a lot of routines which most of the wm* programs use.
-
-       ------------------------------------------------------------
-
-       Copyright (C) 1998 Martijn Pieterse (piete...@xs4all.nl)
-
-       This program is free software; you can redistribute it and/or
-       modify it under the terms of the GNU General Public License
-       as published by the Free Software Foundation; either version 2
-       of the License, or (at your option) any later version.
-
-       This program is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, write to the Free Software
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-       02110-1301, USA.
-
-       ---
-       CHANGES:
-       ---
-       10/10/2003 (Simon Law, sfl...@debian.org)
-               * changed the parse_rcfile function to use getline instead of
-                 fgets.
-       10/14/2000 (Chris Gray, cg...@tribsoft.com)
-               * Removed a bug from parse_rcfile.  An extra
-                 newline would cause a segfault.
-       14/09/1998 (Dave Clark, cla...@skyia.com)
-               * Updated createXBMfromXPM routine
-               * Now supports >256 colors
-       11/09/1998 (Martijn Pieterse, piete...@xs4all.nl)
-               * Removed a bug from parse_rcfile. You could
-                 not use "start" in a command if a label was
-                 also start.
-               * Changed the needed geometry string.
-                 We don't use window size, and don't support
-                 negative positions.
-       03/09/1998 (Martijn Pieterse, piete...@xs4all.nl)
-               * Added parse_rcfile2
-       02/09/1998 (Martijn Pieterse, piete...@xs4all.nl)
-               * Added -geometry support (untested)
-       28/08/1998 (Martijn Pieterse, piete...@xs4all.nl)
-               * Added createXBMfromXPM routine
-               * Saves a lot of work with changing xpm's.
-       02/05/1998 (Martijn Pieterse, piete...@xs4all.nl)
-               * changed the read_rc_file to parse_rcfile, as suggested 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.
-
-*/
-
-#define _POSIX_C_SOURCE 200809L
-#include "wmgeneral.h"
-#include <X11/Xlib.h>                   /* for XCopyArea, etc */
-#include <X11/Xutil.h>                  /* for XSizeHints, XWMHints, etc */
-#include <X11/extensions/shape.h>       /* for XShapeCombineMask */
-#include <X11/extensions/shapeconst.h>  /* for ShapeBounding, ShapeSet */
-#include <X11/xpm.h>                    /* for XpmAttributes, Pixel, etc */
-#include <stddef.h>                     /* for size_t */
-#include <stdio.h>                      /* for fprintf, stderr, NULL, etc */
-#include <stdlib.h>                     /* for exit, free */
-#include <string.h>                     /* for strcmp, strdup, strcspn, etc */
-
-  /*****************/
- /* X11 Variables */
-/*****************/
-
-Window         Root;
-int                    screen;
-int                    x_fd;
-int                    d_depth;
-XSizeHints     mysizehints;
-XWMHints       mywmhints;
-Pixel          back_pix, fore_pix;
-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;
-
-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);
-
-/*******************************************************************************\
-|* parse_rcfile                                                                
                                                                   *|
-\*******************************************************************************/
-
-void parse_rcfile(const char *filename, rckeys *keys) {
-
-       char    *p;
-       FILE    *fp;
-
-       fp = fopen(filename, "r");
-       if (fp) {
-               char temp[128];
-
-               while (fgets(temp, 128, fp)) {
-                       char *q, *saveptr;
-                       char *tokens = " :\t\n";
-                       int key;
-
-                       key = 0;
-                       q = strdup(temp);
-                       q = strtok_r(q, tokens, &saveptr);
-                       if(!q)
-                               continue;
-                       while (key >= 0 && keys[key].label) {
-                               if ((!strcmp(q, keys[key].label))) {
-                                       int i;
-
-                                       p = strstr(temp, keys[key].label);
-                                       p += strlen(keys[key].label);
-                                       p += strspn(p, tokens);
-                                       if ((i = strcspn(p, "#\n"))) p[i] = 
'\0';
-                                       *keys[key].var = strdup(p);
-                                       key = -1;
-                               } else key++;
-                       }
-               }
-               fclose(fp);
-       }
-}
-
-/*******************************************************************************\
-|* parse_rcfile2                                                               
                                                           *|
-\*******************************************************************************/
-
-void parse_rcfile2(const char *filename, rckeys2 *keys) {
-
-       char    *p;
-       char    *line = NULL;
-       size_t  line_size = 0;
-       FILE    *fp;
-
-       fp = fopen(filename, "r");
-       if (fp) {
-               while (getline(&line, &line_size, fp) >= 0) {
-                       int key;
-
-                       key = 0;
-                       while (key >= 0 && keys[key].label) {
-                               if ((p = strstr(line, keys[key].label))) {
-                                       char *tokens = " :\t\n";
-                                       int i;
-
-                                       p += strlen(keys[key].label);
-                                       p += strspn(p, tokens);
-                                       if ((i = strcspn(p, "#\n"))) p[i] = 0;
-                                       *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);
-}
-
-/*******************************************************************************\
-|* createXBMfromXPM                                                            
                                                           *|
-\*******************************************************************************/
-void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
-
-       int     i,j,k;
-       int     width, height, numcol, depth;
-       int     zero=0;
-       int     curpixel;
-
-       sscanf(*xpm, "%10d %10d %10d %10d", &width, &height, &numcol, &depth);
-
-
-       for (k=0; k!=depth; k++)
-       {
-               zero <<=8;
-               zero |= xpm[1][k];
-       }
-
-       for (i=numcol+1; i < numcol+sy+1; i++) {
-               unsigned char bwrite;
-               int bcount;
-
-               bcount = 0;
-               bwrite = 0;
-               for (j=0; j<sx*depth; j+=depth) {
-                       bwrite >>= 1;
-
-                       curpixel=0;
-                       for (k=0; k!=depth; k++)
-                       {
-                               curpixel <<=8;
-                               curpixel |= xpm[i][j+k];
-                       }
-
-                       if ( curpixel != zero ) {
-                               bwrite += 128;
-                       }
-                       bcount++;
-                       if (bcount == 8) {
-                               *xbm = bwrite;
-                               xbm++;
-                               bcount = 0;
-                               bwrite = 0;
-                       }
-               }
-       }
-}
-
-/*******************************************************************************\
-|* 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;
-
-       char                    *geometry = NULL;
-
-       int                             dummy=0;
-       int                             i;
-
-       for (i=1; argv[i]; i++) {
-               if (!strcmp(argv[i], "-display"))
-                       display_name = argv[++i];
-               else if (!strcmp(argv[i], "-geometry"))
-                       geometry = argv[++i];
-       }
-
-       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/wmmon/wmgeneral/wmgeneral.h b/wmmon/wmgeneral/wmgeneral.h
deleted file mode 100644
index c3454c5..0000000
--- a/wmmon/wmgeneral/wmgeneral.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-       wmgeneral was taken from wmppp.
-
-       It has a lot of routines which most of the wm* programs use.
-
-       ------------------------------------------------------------
-
-       Copyright (C) 1998 Martijn Pieterse (piete...@xs4all.nl)
-
-       This program is free software; you can redistribute it and/or
-       modify it under the terms of the GNU General Public License
-       as published by the Free Software Foundation; either version 2
-       of the License, or (at your option) any later version.
-
-       This program is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, write to the Free Software
-       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-       02110-1301, USA.
-
-*/
-
-#ifndef WMGENERAL_H_INCLUDED
-#define WMGENERAL_H_INCLUDED
-
-#include <X11/X.h>                      /* for Pixmap */
-#include <X11/Xlib.h>                   /* for Display */
-#include <X11/xpm.h>                    /* for XpmAttributes */
-
-  /***********/
- /* Defines */
-/***********/
-
-#define MAX_MOUSE_REGION (16)
-
-  /************/
- /* Typedefs */
-/************/
-
-struct _rckeys {
-       const char      *label;
-       char            **var;
-};
-
-typedef struct _rckeys rckeys;
-
-struct _rckeys2 {
-       const char      *family;
-       const char      *label;
-       char            **var;
-};
-
-typedef struct _rckeys2 rckeys2;
-
-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 createXBMfromXPM(char *, char **, int, int);
-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
diff --git a/wmmon/wmmon/Makefile b/wmmon/wmmon/Makefile
old mode 100755
new mode 100644
index a767ba0..7466113
--- a/wmmon/wmmon/Makefile
+++ b/wmmon/wmmon/Makefile
@@ -1,14 +1,10 @@
-LIBDIR = -L/usr/X11R6/lib
-LIBS   = -lXpm -lXext -lX11
-OBJS =  wmmon.o \
-               ../wmgeneral/wmgeneral.o \
-               ../wmgeneral/misc.o \
-               ../wmgeneral/list.o
+LIBDIR = -L/usr/X11R6/lib -L/usr/local/lib
+LIBS   = -lXpm -lXext -lX11 -lwmgeneral
+OBJS =  wmmon.o
 
 CFLAGS = -O2
 CC = cc
 
-
 .c.o:
        $(CC) $(CFLAGS) -c -Wall $< -o $*.o
 
diff --git a/wmmon/wmmon/wmmon.c b/wmmon/wmmon/wmmon.c
index b1f5303..a3df7fe 100644
--- a/wmmon/wmmon/wmmon.c
+++ b/wmmon/wmmon/wmmon.c
@@ -108,8 +108,8 @@
 #include <X11/xpm.h>
 #include <X11/extensions/shape.h>
 
-#include "../wmgeneral/wmgeneral.h"
-#include "../wmgeneral/misc.h"
+#include <wmgeneral/wmgeneral.h>
+#include <wmgeneral/misc.h>
 
 #include "wmmon-master.xpm"
 #include "wmmon-mask.xbm"
-- 
2.5.0


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

Reply via email to