Doug Torrance <dtorra...@piedmont.edu> escribió:

On 08/15/2015 06:29 PM, Rodolfo García Peñas (kix) wrote:
I modified all other dockapps.

Thanks for doing this!

The wmbiff dockapp includes a different wmgeneral library. This dockapp
doesn't compile. I don't include this new code in libdockapps because
include code of application that doesn't compile IMO is not a good idea.

Probably we should try to compile the wmbiff dockapps, and then, think
about include or not the three new functions in libdockapp.

This is something I've looked at a little bit.  I have a branch [1] with
a partially working wmbiff which uses the shared wmgeneral library
(after adding the wmbiff-specific functions to the library, as you
mentioned).

However, wmbiff is special in that it allows non-64x64 windows, and this
is the main diverence from the main wmgeneral functions.  I haven't
gotten around to solving this issue yet.

Doug

[1] https://github.com/d-torrance/dockapps/tree/update-wmbiff

Hi Doug,

we can compile it with this little change in tlsComm.c:

-struct connection_state *initialize_gnutls(UNUSED(int sd),
+struct connection_state *initialize_gnutls(UNUSED(intptr_t sd),

I did the changes to run using wmgeneral, are attached for your testing.

About the size, I don't know, I need more time.

Cheers,
kix
Rodolfo García Peñas (kix)
http://www.kix.es/
>From b465e053f6153c477eba250ecab9305c6c658148 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?=
 <k...@kix.es>
Date: Sat, 15 Aug 2015 23:47:29 +0200
Subject: [PATCH 1/2] Include the wmbiff functions of wmgeneral.

The wmbiff application included some functions in wmgeneral. We need
include these functions in the libdockapp library. Probably we should
analize if these functions should be included in wmbiff and removed
from here.
---
 libdockapp/src/wmgeneral.c | 39 +++++++++++++++++++++++++++++++++++++++
 libdockapp/src/wmgeneral.h |  8 ++++++++
 2 files changed, 47 insertions(+)

diff --git a/libdockapp/src/wmgeneral.c b/libdockapp/src/wmgeneral.c
index c624193..5511a31 100644
--- a/libdockapp/src/wmgeneral.c
+++ b/libdockapp/src/wmgeneral.c
@@ -84,6 +84,7 @@ Pixel		back_pix, fore_pix;
 Window		iconwin, win;
 GC			NormalGC;
 XpmIcon		wmgen;
+XpmIcon		wmgen_bkg;
 Pixmap		pixmask;
 
   /*****************/
@@ -378,6 +379,44 @@ void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
 }
 
 
+/* added for wmbiff */
+XFontStruct *f;
+int loadFont(const char *fontname)
+{
+	if (display != NULL) {
+		f = XLoadQueryFont(display, fontname);
+		if (f) {
+			XSetFont(display, NormalGC, f->fid);
+			return 0;
+		} else {
+			printf("couldn't set font!\n");
+		}
+	}
+	return -1;
+}
+
+void drawString(int dest_x, int dest_y, const char *string,
+				const char *colorname, const char *bgcolorname,
+				int right_justify)
+{
+	int len = strlen(string);
+	XSetForeground(display, NormalGC, GetColor((char *) colorname));
+	XSetBackground(display, NormalGC, GetColor((char *) bgcolorname));
+	if (right_justify)
+		dest_x -= XTextWidth(f, string, len);
+	XDrawImageString(display, wmgen_bkg.pixmap, NormalGC, dest_x, dest_y,
+					 string, len);
+}
+
+void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname)
+{
+	XSetForeground(display, NormalGC, GetColor((char *) bgcolorname));
+	XFillRectangle(display, wmgen_bkg.pixmap, NormalGC, x, y, x2 - x,
+				   y2 - y);
+}
+
+/* end wmbiff additions */
+
 /*******************************************************************************\
 |* setMaskXY																   *|
 \*******************************************************************************/
diff --git a/libdockapp/src/wmgeneral.h b/libdockapp/src/wmgeneral.h
index c3454c5..620f4de 100644
--- a/libdockapp/src/wmgeneral.h
+++ b/libdockapp/src/wmgeneral.h
@@ -86,4 +86,12 @@ void setMaskXY(int, int);
 
 void parse_rcfile(const char *, rckeys *);
 
+/* for wmbiff */
+int loadFont(const char *fontname);	/* -1 on fail, 0 success. */
+void drawString(int dest_x, int dest_y, const char *string,
+				const char *colorname, const char *bgcolorname,
+				int right_justify);
+void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname);
+/* end wmbiff */
+
 #endif
-- 
2.5.0

>From 1ccb7be60ad49b035e36ae056f8706f4f250c97e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?=
 <k...@kix.es>
Date: Sun, 16 Aug 2015 00:20:40 +0200
Subject: [PATCH 2/2] wmbiff

---
 wmbiff/Makefile.am           |   3 +-
 wmbiff/configure.ac          |   4 +-
 wmbiff/wmbiff/Makefile.am    |   4 +-
 wmbiff/wmbiff/wmbiff.c       |  27 +-
 wmbiff/wmgeneral/Makefile.am |  10 -
 wmbiff/wmgeneral/misc.c      |  34 ---
 wmbiff/wmgeneral/misc.h      |   9 -
 wmbiff/wmgeneral/wmgeneral.c | 621 -------------------------------------------
 wmbiff/wmgeneral/wmgeneral.h |  69 -----
 9 files changed, 21 insertions(+), 760 deletions(-)
 delete mode 100644 wmbiff/wmgeneral/Makefile.am
 delete mode 100644 wmbiff/wmgeneral/misc.c
 delete mode 100644 wmbiff/wmgeneral/misc.h
 delete mode 100644 wmbiff/wmgeneral/wmgeneral.c
 delete mode 100644 wmbiff/wmgeneral/wmgeneral.h

diff --git a/wmbiff/Makefile.am b/wmbiff/Makefile.am
index c971f1c..e1fd1cf 100644
--- a/wmbiff/Makefile.am
+++ b/wmbiff/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = wmgeneral wmbiff autoconf scripts
+SUBDIRS = wmbiff autoconf scripts
 EXTRA_DIST = ChangeLog FAQ TODO
 
 ACLOCAL_FLAGS = -I autoconf
@@ -26,7 +26,6 @@ dist-hook-local: ChangeLog
 
 indent:
 	cd wmbiff && make indent
-	cd wmgeneral && make indent
 
 # manually increment version in configure.ac, which should be enough.
 ChangeLog: Makefile configure.ac
diff --git a/wmbiff/configure.ac b/wmbiff/configure.ac
index a1ae56c..ff98940 100644
--- a/wmbiff/configure.ac
+++ b/wmbiff/configure.ac
@@ -114,7 +114,7 @@ AC_PATH_XTRA
 if test "$no_x" = yes; then
    AC_MSG_ERROR("Really need a working X.  Check config.log to see why configure couldn't find it")
 fi
-LIBS="$X_LIBS $LIBS"
+LIBS="$X_LIBS $LIBS -ldockapp"
 dnl want to get the -I flags so that later tests for include files work.
 dnl the preprocessor is used for check_headers, which doesn't use cflags.
 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
@@ -180,7 +180,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_SKIN_PATH,
                    "$SKINDIR:/usr/share/wmbiff/skins:/usr/local/share/wmbiff/skins:.", [Path to use when finding skins (modified pixmaps)] )
 
 dnl We're done.
-AC_CONFIG_FILES(Makefile wmbiff/Makefile wmgeneral/Makefile wmbiff/wmbiffrc.5 autoconf/Makefile scripts/Makefile)
+AC_CONFIG_FILES(Makefile wmbiff/Makefile wmbiff/wmbiffrc.5 autoconf/Makefile scripts/Makefile)
 AC_OUTPUT
 dnl remind not to write the file.
 chmod 0444 wmbiff/wmbiffrc.5
diff --git a/wmbiff/wmbiff/Makefile.am b/wmbiff/wmbiff/Makefile.am
index c69c546..18a7f1e 100644
--- a/wmbiff/wmbiff/Makefile.am
+++ b/wmbiff/wmbiff/Makefile.am
@@ -6,8 +6,8 @@ wmbiff_SOURCES = wmbiff.c socket.c Pop3Client.c mboxClient.c \
 	passwordMgr.c passwordMgr.h charutil.c charutil.h Client.h  \
 	regulo.c regulo.h  MessageList.c MessageList.h
 EXTRA_wmbiff_SOURCES = gnutls-common.c gnutls-common.h
-wmbiff_LDADD = -L../wmgeneral -lwmgeneral @LIBGCRYPT_LIBS@ @GNUTLS_COMMON_O@
-wmbiff_DEPENDENCIES = ../wmgeneral/libwmgeneral.a Makefile @GNUTLS_COMMON_O@
+wmbiff_LDADD = @LIBGCRYPT_LIBS@ @GNUTLS_COMMON_O@ -ldockapp
+wmbiff_DEPENDENCIES = Makefile @GNUTLS_COMMON_O@
 test_wmbiff_SOURCES = ShellClient.c charutil.c charutil.h Client.h \
 	test_wmbiff.c passwordMgr.c Imap4Client.c regulo.c Pop3Client.c \
 	tlsComm.c tlsComm.h socket.c
diff --git a/wmbiff/wmbiff/wmbiff.c b/wmbiff/wmbiff/wmbiff.c
index ddc7f3f..12b1abb 100644
--- a/wmbiff/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff/wmbiff.c
@@ -28,8 +28,8 @@
 #include <errno.h>
 #include <string.h>
 
-#include "../wmgeneral/wmgeneral.h"
-#include "../wmgeneral/misc.h"
+#include <libdockapp/wmgeneral.h>
+#include <libdockapp/misc.h>
 
 #include "Client.h"
 #include "charutil.h"
@@ -733,7 +733,7 @@ static void execnotify( /*@null@ */ const char *notifycmd)
 			/* Yes, nothing */
 		} else {
 			/* Else call external notifyer, ignoring the pid */
-			(void) execCommand(notifycmd);
+			(void) execCommand((char *) notifycmd);
 		}
 	}
 }
@@ -1099,14 +1099,14 @@ extern void ProcessPendingEvents(void)
 					&& strcmp(extra_click_action, "msglst")) {
 					DM(&mbox[but_released_region], DEBUG_INFO,
 					   "runing: %s", extra_click_action);
-					(void) execCommand(extra_click_action);
+					(void) execCommand((char *) extra_click_action);
 				}
 				if (click_action != NULL
 					&& click_action[0] != '\0'
 					&& strcmp(click_action, "msglst")) {
 					DM(&mbox[but_released_region], DEBUG_INFO,
 					   "running: %s", click_action);
-					(void) execCommand(click_action);
+					(void) execCommand((char *) click_action);
 				}
 			}
 
@@ -1128,7 +1128,7 @@ extern void ProcessPendingEvents(void)
 						&& strcmp(click_action, "msglst")) {
 						DM(&mbox[but_released_region], DEBUG_INFO,
 						   "running: %s", click_action);
-						(void) execCommand(click_action);
+						(void) execCommand((char *) click_action);
 					}
 				}
 
@@ -1162,13 +1162,18 @@ static void do_biff(int argc, const char **argv)
 		skin_xpm = (classic_mode ? wmbiff_classic_master_xpm : wmbiff_master_xpm);
 	}
 
-	bkg_xpm = (const char **) CreateBackingXPM(wmbiff_mask_width, wmbiff_mask_height, skin_xpm);
-
-	createXBMfromXPM(wmbiff_mask_bits, (const char**)bkg_xpm,
+	createXBMfromXPM(wmbiff_mask_bits, (char**)bkg_xpm,
 					 wmbiff_mask_width, wmbiff_mask_height);
 
-	openXwindow(argc, argv, (const char**)bkg_xpm, skin_xpm, wmbiff_mask_bits,
-				wmbiff_mask_width, wmbiff_mask_height, notWithdrawn);
+/*void openXwindow(int argc, const char *argv[],
+                                 const char *pixmap_bytes_bkg[],
+                                 const char *pixmap_bytes_src[], char *pixmask_bits,
+                                 int pixmask_width, int pixmask_height, int notWithdrawn)
+void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height)
+*/
+
+	openXwindow(argc, (char **) argv, (char **) skin_xpm, (char *) wmbiff_mask_bits,
+				wmbiff_mask_width, wmbiff_mask_height);
 
 	/* now that display is set, we can create the cursors
 	   (mouse pointer shapes) */
diff --git a/wmbiff/wmgeneral/Makefile.am b/wmbiff/wmgeneral/Makefile.am
deleted file mode 100644
index 0b3bc5d..0000000
--- a/wmbiff/wmgeneral/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-noinst_LIBRARIES = libwmgeneral.a
-libwmgeneral_a_SOURCES = misc.c misc.h wmgeneral.c wmgeneral.h
-
-MAINTAINERCLEANFILES = Makefile.in
-
-
-indent:
-	indent -npro -kr -i4 -ts4 $(libwmgeneral_a_SOURCES) || true
-
-dist-hook-local: indent
diff --git a/wmbiff/wmgeneral/misc.c b/wmbiff/wmgeneral/misc.c
deleted file mode 100644
index 3733aa1..0000000
--- a/wmbiff/wmgeneral/misc.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* dock.c- built-in Dock module for WindowMaker
- *
- *  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.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "misc.h"
-
-extern pid_t execCommand(const char *command)
-{
-	pid_t pid;
-
-	if ((pid = fork()) == 0) {
-		execl("/bin/sh", "sh", "-c", command, (char *) 0);
-	}
-	return pid;
-}
diff --git a/wmbiff/wmgeneral/misc.h b/wmbiff/wmgeneral/misc.h
deleted file mode 100644
index 2546bcb..0000000
--- a/wmbiff/wmgeneral/misc.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __MISC_H
-#define __MISC_H
-
-#include <unistd.h>
-
-extern void parse_command(char *, char ***, int *);
-
-extern pid_t execCommand(const char *);
-#endif							/* __MISC_H */
diff --git a/wmbiff/wmgeneral/wmgeneral.c b/wmbiff/wmgeneral/wmgeneral.c
deleted file mode 100644
index ddae0d7..0000000
--- a/wmbiff/wmgeneral/wmgeneral.c
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
-	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:
-    ---
-    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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <assert.h>
-
-#include <X11/Xlib.h>
-#ifdef HAVE_X11_XPM_H
-#include <X11/xpm.h>
-#endif
-#ifdef HAVE_XPM_H
-#include <xpm.h>
-#endif
-#include <X11/Xutil.h>			/* needed for Region on solaris? */
-#include <X11/extensions/shape.h>
-
-#include "wmgeneral.h"
-
-  /*****************/
- /* X11 Variables */
-/*****************/
-
-Window Root;
-int screen;
-int x_fd;
-int d_depth;
-XSizeHints mysizehints;
-XWMHints mywmhints;
-Pixel back_pix, fore_pix;
-// static const char *Geometry = "";
-Window iconwin, win;
-GC NormalGC;
-XpmIcon wmgen_bkg;
-XpmIcon wmgen_src;
-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 *, const char **);
-Pixel GetColor(const char *);
-void RedrawWindow(void);
-int CheckMouseRegion(int, int);
-
-/*******************************************************************************\
-|* parse_rcfile																   *|
-\*******************************************************************************/
-
-void parse_rcfile(const char *filename, rckeys * keys)
-{
-
-	char *p, *q;
-	char temp[128];
-	const char *tokens = " :\t\n";
-	FILE *fp;
-	int i, key;
-
-	fp = fopen(filename, "r");
-	if (fp) {
-		while (fgets(temp, 128, fp)) {
-			key = 0;
-			q = strdup(temp);
-			q = strtok(q, tokens);
-			while (key >= 0 && keys[key].label) {
-				if ((!strcmp(q, keys[key].label))) {
-					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++;
-			}
-			free(q);
-		}
-		fclose(fp);
-	}
-}
-
-/*******************************************************************************\
-|* parse_rcfile2															   *|
-\*******************************************************************************/
-
-void parse_rcfile2(const char *filename, rckeys2 * keys)
-{
-
-	char *p;
-	char temp[128];
-	const char *tokens = " :\t\n";
-	FILE *fp;
-	int i, key;
-	char *family = NULL;
-
-	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);
-	}
-	free(family);
-}
-
-
-/*******************************************************************************\
-|* GetXPM																	   *|
-\*******************************************************************************/
-
-static void GetXPM(XpmIcon * wmgen_local, const char *pixmap_bytes[])
-{
-
-	XWindowAttributes attributes;
-	int err;
-
-	/* For the colormap */
-	XGetWindowAttributes(display, Root, &attributes);
-	/* despite the comment, I still don't understand...
-	   attributes is subsequently unused in this function -ns 11/2002 */
-
-	wmgen_local->attributes.valuemask |=
-		(XpmReturnPixels | XpmReturnExtensions);
-
-	err = XpmCreatePixmapFromData(display, Root, (char **) pixmap_bytes,
-								  &(wmgen_local->pixmap),
-								  &(wmgen_local->mask),
-								  &(wmgen_local->attributes));
-
-	if (err != XpmSuccess) {
-		fprintf(stderr,
-				"Not enough free colorcells to create pixmap from data (err=%d).\n",
-				err);
-		exit(1);
-	}
-}
-
-/*******************************************************************************\
-|* GetColor																	   *|
-\*******************************************************************************/
-
-Pixel GetColor(const char *name)
-{
-
-	XColor color;
-	XWindowAttributes attributes;
-
-	XGetWindowAttributes(display, Root, &attributes);
-
-	color.pixel = 0;
-	if (!XParseColor(display, attributes.colormap, name, &color)) {
-		fprintf(stderr, "wm.app: GetColor() can't parse %s.\n", name);
-	} else if (!XAllocColor(display, attributes.colormap, &color)) {
-		fprintf(stderr, "wm.app: GetColor() 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_bkg.pixmap, iconwin, NormalGC,
-			  0, 0, wmgen_bkg.attributes.width,
-			  wmgen_bkg.attributes.height, 0, 0);
-	flush_expose(win);
-	XCopyArea(display, wmgen_bkg.pixmap, win, NormalGC,
-			  0, 0, wmgen_bkg.attributes.width,
-			  wmgen_bkg.attributes.height, 0, 0);
-}
-
-/*******************************************************************************\
-|* RedrawWindowXY															   *|
-\*******************************************************************************/
-
-void RedrawWindowXY(int x, int y)
-{
-
-	flush_expose(iconwin);
-	XCopyArea(display, wmgen_bkg.pixmap, iconwin, NormalGC,
-			  x, y, wmgen_bkg.attributes.width,
-			  wmgen_bkg.attributes.height, 0, 0);
-	flush_expose(win);
-	XCopyArea(display, wmgen_bkg.pixmap, win, NormalGC,
-			  x, y, wmgen_bkg.attributes.width,
-			  wmgen_bkg.attributes.height, 0, 0);
-}
-
-/*******************************************************************************\
-|* AddMouseRegion															   *|
-\*******************************************************************************/
-
-void AddMouseRegion(unsigned int region_idx, int left, int top, int right,
-					int bottom)
-{
-
-	if (region_idx < MAX_MOUSE_REGION) {
-		mouse_region[region_idx].enable = 1;
-		mouse_region[region_idx].top = top;
-		mouse_region[region_idx].left = left;
-		mouse_region[region_idx].bottom = bottom;
-		mouse_region[region_idx].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, const char **xpm, int sx, int sy)
-{
-
-	int i, j, k;
-	int width, height, numcol, depth;
-	int zero = 0;
-	unsigned char bwrite;
-	int bcount;
-	int curpixel;
-
-	sscanf(*xpm, "%d %d %d %d", &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++) {
-		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 src_x, int src_y, int width, int height, int dest_x,
-				 int dest_y)
-{
-
-	XCopyArea(display, wmgen_src.pixmap, wmgen_bkg.pixmap, NormalGC, src_x,
-			  src_y, width, height, dest_x, dest_y);
-
-}
-
-/*******************************************************************************\
-|* copyXBMArea																   *|
-\*******************************************************************************/
-
-void copyXBMArea(int src_x, int src_y, int width, int height, int dest_x,
-				 int dest_y)
-{
-
-	XCopyArea(display, wmgen_src.mask, wmgen_bkg.pixmap, NormalGC, src_x,
-			  src_y, width, height, dest_x, dest_y);
-}
-
-
-/* added for wmbiff */
-XFontStruct *f;
-int loadFont(const char *fontname)
-{
-	if (display != NULL) {
-		f = XLoadQueryFont(display, fontname);
-		if (f) {
-			XSetFont(display, NormalGC, f->fid);
-			return 0;
-		} else {
-			printf("couldn't set font!\n");
-		}
-	}
-	return -1;
-}
-
-void drawString(int dest_x, int dest_y, const char *string,
-				const char *colorname, const char *bgcolorname,
-				int right_justify)
-{
-	int len = strlen(string);
-	assert(colorname != NULL);
-	XSetForeground(display, NormalGC, GetColor(colorname));
-	XSetBackground(display, NormalGC, GetColor(bgcolorname));
-	if (right_justify)
-		dest_x -= XTextWidth(f, string, len);
-	XDrawImageString(display, wmgen_bkg.pixmap, NormalGC, dest_x, dest_y,
-					 string, len);
-}
-
-void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname)
-{
-	XSetForeground(display, NormalGC, GetColor(bgcolorname));
-	XFillRectangle(display, wmgen_bkg.pixmap, NormalGC, x, y, x2 - x,
-				   y2 - y);
-}
-
-/* end wmbiff additions */
-
-/*******************************************************************************\
-|* 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, const char *argv[],
-				 const char *pixmap_bytes_bkg[],
-				 const char *pixmap_bytes_src[], char *pixmask_bits,
-				 int pixmask_width, int pixmask_height, int notWithdrawn)
-{
-
-	unsigned int borderwidth = 1;
-	XClassHint classHint;
-	const char *display_name = NULL;
-	char *wname = strdup(argv[0]);
-	XTextProperty name;
-
-	XGCValues gcv;
-	unsigned long gcm;
-
-	const char *geometry = NULL;
-	char default_geometry[128];
-
-	int dummy = 0;
-	int i;
-
-	if (!wname) {
-		fprintf(stderr, "Unable to allocate memory for window name!\n");
-		abort();
-	}
-
-	for (i = 1; argv[i]; i++) {
-		if (!strcmp(argv[i], "-display") && i < argc - 1) {
-			display_name = argv[i + 1];
-			i++;
-		}
-		if (!strcmp(argv[i], "-geometry") && i < argc - 1) {
-			geometry = argv[i + 1];
-			i++;
-		}
-	}
-
-	sprintf(default_geometry, "%dx%d+0+0", pixmask_width, pixmask_height);
-
-	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_bkg, pixmap_bytes_bkg);
-	GetXPM(&wmgen_src, pixmap_bytes_src);
-
-	/* Create a window to hold the stuff */
-	mysizehints.flags = USSize | USPosition;
-	mysizehints.x = 0;
-	mysizehints.y = 0;
-
-	back_pix = GetColor("black");
-	fore_pix = GetColor("cyan");
-
-	XWMGeometry(display, screen, geometry, default_geometry, borderwidth,
-				&mysizehints, &mysizehints.x, &mysizehints.y,
-				&mysizehints.width, &mysizehints.height, &dummy);
-
-	mysizehints.width = pixmask_width;	/* changed 11/2002 for wmbiff non 64x64-ness */
-	mysizehints.height = pixmask_height;	/* was statically 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);
-
-    /* Was PointerMotionMask instead of KeyPressMask, but pointer motion is irrelevant,
-       and if the user went to the trouble of giving us keypresses, the least we can do
-       is handle em... */
-	XSelectInput(display, win,
-				 ButtonPressMask | ExposureMask | ButtonReleaseMask |
-				 KeyPressMask | StructureNotifyMask);
-	XSelectInput(display, iconwin,
-				 ButtonPressMask | ExposureMask | ButtonReleaseMask |
-				 KeyPressMask | StructureNotifyMask);
-
-	/* wname is argv[0] */
-	if (XStringListToTextProperty(&wname, 1, &name) == 0) {
-		fprintf(stderr, "%s: can't allocate window name\n", wname);
-		exit(1);
-	}
-
-	XSetWMName(display, win, &name);
-	XFree(name.value);
-
-	/* 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 =
-		(notWithdrawn ? 0 : StateHint) | IconWindowHint |
-		IconPositionHint | WindowGroupHint;
-
-	XSetWMHints(display, win, &mywmhints);
-
-	XSetCommand(display, win, (char **) argv, argc);
-	XMapWindow(display, win);
-
-	if (geometry) {
-		/* we'll silently drop width and height as well as negative positions */
-		/* mostly because I don't know how to deal with them */
-		/*
-		   int wx, wy, x, y;
-		   int specified = XParseGeometry(geometry, &x, &y, &wx, &wy);
-		   printf("%d %d %d %d\n", x, y, wx, wy);
-		   if( specified & XNegative ) {
-		   x = DisplayWidth(display, DefaultScreen(display)) - x - pixmask_width;
-		   }
-		   if( specified & YNegative ) {
-		   y = DisplayHeight(display, DefaultScreen(display)) - y - pixmask_height;
-		   }
-		   if( specified & XValue || specified & YValue ) {
-		   XMoveWindow(display, win, x, y);
-		   } */
-
-		/*
-		   if (sscanf(geometry, "+%d+%d", &wx, &wy) == 2) {
-		   XMoveWindow(display, win, wx, wy);
-		   } else if (sscanf(geometry, "%dx%d+%d+%d", &x, &y, &wx, &wy) == 4) {
-		   XMoveWindow(display, win, wx, wy);
-		   } else if (sscanf(geometry, "+%d-%d", &wx, &wy) == 2) {
-		   XMoveWindow(display, win, wx, 0 - wy);
-		   }  else {
-		   fprintf(stderr, "Unsupported geometry string '%s'\n",
-		   geometry);
-		   exit(1);
-		   } */
-	}
-
-	if (wname)
-		free(wname);
-}
diff --git a/wmbiff/wmgeneral/wmgeneral.h b/wmbiff/wmgeneral/wmgeneral.h
deleted file mode 100644
index 8496966..0000000
--- a/wmbiff/wmgeneral/wmgeneral.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef WMGENERAL_H_INCLUDED
-#define WMGENERAL_H_INCLUDED
-
-  /***********/
- /* Defines */
-/***********/
-
-#define MAX_MOUSE_REGION (40)
-
-  /************/
- /* Typedefs */
-/************/
-
-typedef struct _rckeys rckeys;
-
-struct _rckeys {
-	const char *label;
-	char **var;
-};
-
-typedef struct _rckeys2 rckeys2;
-
-struct _rckeys2 {
-	const char *family;
-	const char *label;
-	char **var;
-};
-
-typedef struct {
-	Pixmap pixmap;
-	Pixmap mask;
-	XpmAttributes attributes;
-} XpmIcon;
-
-  /*******************/
- /* Global variable */
-/*******************/
-
-Display *display;
-
-  /***********************/
- /* Function Prototypes */
-/***********************/
-
-void AddMouseRegion(unsigned int rgn_index, int left, int top, int right,
-					int bottom);
-int CheckMouseRegion(int x, int y);
-
-void openXwindow(int argc, const char *argv[], const char **,
-				 const char **, char *, int, int, int);
-void RedrawWindow(void);
-void RedrawWindowXY(int x, int y);
-
-void createXBMfromXPM(char *, const 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 *);
-
-/* for wmbiff */
-int loadFont(const char *fontname);	/* -1 on fail, 0 success. */
-void drawString(int dest_x, int dest_y, const char *string,
-				const char *colorname, const char *bgcolorname,
-				int right_justify);
-void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname);
-/* end wmbiff */
-
-#endif
-- 
2.5.0

Reply via email to