[Pkg-wmaker-commits] [wmbiff] 20/84: font support, ability to erase rectangles

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:01:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_10
in repository wmbiff.

commit 56db9d1ed26591eedf3be3ac31dc0a436cdc2a97
Author: bluehal <bluehal>
Date:   Sat Jun 8 22:15:28 2002 +0000

    font support, ability to erase rectangles
---
 wmgeneral/wmgeneral.c | 26 +++++++++++++++++++-------
 wmgeneral/wmgeneral.h |  4 +++-
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index eb4a08a..d242459 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -47,6 +47,7 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <stdarg.h>
+#include <assert.h>
 
 #include <X11/Xlib.h>
 #ifdef HAVE_X11_XPM_H
@@ -217,9 +218,9 @@ static Pixel GetColor(const char *name)
 
 	color.pixel = 0;
 	if (!XParseColor(display, attributes.colormap, name, &color)) {
-		fprintf(stderr, "wm.app: can't parse %s.\n", name);
+		fprintf(stderr, "wm.app: GetColor() can't parse %s.\n", name);
 	} else if (!XAllocColor(display, attributes.colormap, &color)) {
-		fprintf(stderr, "wm.app: can't allocate %s.\n", name);
+		fprintf(stderr, "wm.app: GetColor() can't allocate %s.\n", name);
 	}
 	return color.pixel;
 }
@@ -386,25 +387,36 @@ void copyXBMArea(int src_x, int src_y, int width, int height, int dest_x,
 
 /* added for wmbiff */
 XFontStruct *f;
-void loadFont(const char *fontname)
+int loadFont(const char *fontname)
 {
 	if (display != NULL) {
 		f = XLoadQueryFont(display, fontname);
-		if (f)
+		if (f) {
 			XSetFont(display, NormalGC, f->fid);
-		else
+			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, int right_justify)
 {
 	int len = strlen(string);
+	assert(colorname != NULL);
 	XSetForeground(display, NormalGC, GetColor(colorname));
 	if (right_justify)
 		dest_x -= XTextWidth(f, string, len);
-	XDrawString(display, wmgen.pixmap, NormalGC, dest_x, dest_y, string,
-				len);
+	XDrawImageString(display, wmgen.pixmap, NormalGC, dest_x, dest_y,
+					 string, len);
+}
+
+void eraseRect(int x, int y, int x2, int y2)
+{
+	XSetForeground(display, NormalGC, GetColor("black"));
+	XFillRectangle(display, wmgen.pixmap, NormalGC, x, y, x2 - x, y2 - y);
 }
 
 /* end wmbiff additions */
diff --git a/wmgeneral/wmgeneral.h b/wmgeneral/wmgeneral.h
index 6686638..75a8cfd 100644
--- a/wmgeneral/wmgeneral.h
+++ b/wmgeneral/wmgeneral.h
@@ -58,8 +58,10 @@ void setMaskXY(int, int);
 void parse_rcfile(const char *, rckeys *);
 
 /* for wmbiff */
-void loadFont(const char *fontname);
+int loadFont(const char *fontname);	/* -1 on fail, 0 success. */
 void drawString(int dest_x, int dest_y, const char *string,
 				const char *colorname, int right_justify);
+void eraseRect(int x, int y, int x2, int y2);
+/* end wmbiff */
 
 #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list