[Pkg-wmaker-commits] [wmbiff] 10/15: support setting the background color using -bg

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


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

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

commit 2b0a270463f87e61b963df079842d2dd356eac31
Author: bluehal <bluehal>
Date:   Sun Mar 30 10:38:37 2003 +0000

    support setting the background color using -bg
---
 NEWS                  |  4 +++-
 README                |  2 ++
 wmbiff/wmbiff.c       | 35 ++++++++++++++++++++++++++---------
 wmgeneral/wmgeneral.c |  8 +++++---
 wmgeneral/wmgeneral.h |  5 +++--
 5 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/NEWS b/NEWS
index 8741549..e50f661 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ Release 0.4.15 - Mar x, 2003
   * Tighten configuration file lines to more quickly
     detect misconfiguration; give the -relax option if
     it is too paranoid.
+  * Add support for -bg to round out -hi and -fg color
+    specifiers.
 
 Release 0.4.14 - Jan 24, 2003
   * Handle building on systems with both posix and gnu
@@ -411,4 +413,4 @@ Release 0.1 - Wed, 17 Nov 1999 00:00:00 +0000
   * Initial release by Gennady Belyakov <gb at ccat.elect.ru>.
 
 
-$Id: NEWS,v 1.40 2003/03/02 02:37:07 bluehal Exp $
+$Id: NEWS,v 1.41 2003/03/30 10:38:37 bluehal Exp $
diff --git a/README b/README
index 246d5a2..07a9d43 100644
--- a/README
+++ b/README
@@ -70,6 +70,8 @@ position. All other positions will be empty.
  
     wmbiff-devel at lists.sourceforge.net
 
+   Please include the output of 'wmbiff -debug'.
+
      _________________________________________________________________
 
 UPDATE [2001-06-18]:
diff --git a/wmbiff/wmbiff.c b/wmbiff/wmbiff.c
index e4c70be..f6ad6fe 100644
--- a/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff.c
@@ -1,4 +1,4 @@
-/* $Id: wmbiff.c,v 1.51 2003/03/06 21:15:15 bluehal Exp $ */
+/* $Id: wmbiff.c,v 1.52 2003/03/30 10:38:38 bluehal Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -73,7 +73,8 @@ static const char *font = NULL;
 int debug_default = DEBUG_ERROR;
 
 /* color from wmbiff's xpm, down to 24 bits. */
-static const char *foreground = "#21B3AF";
+static const char *foreground = "#21B3AF";	/* foreground cyan */
+static const char *background = "#202020";	/* background gray */
 static const char *highlight = "yellow";
 int SkipCertificateCheck = 0;
 int Relax = 0;					/* be not paranoid */
@@ -516,7 +517,7 @@ static int wmbiffrc_permissions_check(const char *wmbiffrc_fname)
 static void ClearDigits(unsigned int i)
 {
 	if (font) {
-		eraseRect(39, mbox_y(i), 58, mbox_y(i + 1) - 1);
+		eraseRect(39, mbox_y(i), 58, mbox_y(i + 1) - 1, background);
 	} else {
 		/* overwrite the colon */
 		copyXPMArea((10 * (CHAR_WIDTH + 1)), 64, (CHAR_WIDTH + 1),
@@ -534,8 +535,8 @@ static void BlitString(const char *name, int x, int y, int new)
 	if (font != NULL) {
 		/* an alternate behavior - draw the string using a font
 		   instead of the pixmap.  should allow pretty colors */
-		drawString(x, y + CHAR_HEIGHT, name, new ? highlight : foreground,
-				   0);
+		drawString(x, y + CHAR_HEIGHT + 1, name,
+				   new ? highlight : foreground, background, 0);
 	} else {
 		/* normal, LED-like behavior. */
 		int i, c, k = x;
@@ -571,8 +572,8 @@ static void BlitNum(int num, int x, int y, int new)
 
 	if (font != NULL) {
 		const char *color = (new) ? highlight : foreground;
-		drawString(x + (CHAR_WIDTH * 2 + 4), y + CHAR_HEIGHT, buf,
-				   color, 1);
+		drawString(x + (CHAR_WIDTH * 2 + 4), y + CHAR_HEIGHT + 1, buf,
+				   color, background, 1);
 	} else {
 		int newx = x;
 
@@ -789,6 +790,8 @@ static char **CreateBackingXPM(int width, int height,
 	sprintf(ret[0], "%d %d %d %d", width, height, colors, 1);
 	ret[1] = (char *) " \tc #0000FF";	/* no color */
 	ret[2] = (char *) ".\tc #202020";	/* background gray */
+	ret[2] = malloc_ordie(30);
+	sprintf(ret[2], ".\tc %s", background);
 	ret[3] = (char *) "+\tc #000000";	/* shadowed */
 	ret[4] = (char *) "@\tc #C7C3C7";	/* highlight */
 	ret[5] = (char *) ":\tc #004941";	/* led off */
@@ -916,8 +919,10 @@ static void do_biff(int argc, const char **argv)
 			exit(EXIT_FAILURE);
 		}
 		/* make the whole background black */
-		eraseRect(x_origin, y_origin,
-				  wmbiff_mask_width - 6, wmbiff_mask_height - 6);
+		// removed; seems unnecessary with CreateBackingXPM 
+		//      eraseRect(x_origin, y_origin,
+		//    wmbiff_mask_width - 6, wmbiff_mask_height - 6, 
+		//          background);
 	}
 
 	/* First time setup of button regions and labels */
@@ -1009,6 +1014,7 @@ static void usage(void)
 		   "Please report bugs to %s\n"
 		   "\n"
 		   "usage:\n"
+		   "    -bg <color>               background color\n"
 		   "    -c <filename>             use specified config file\n"
 		   "    -debug                    enable debugging\n"
 		   "    -display <display name>   use specified X display\n"
@@ -1049,6 +1055,17 @@ static void parse_cmd(int argc, const char **argv,	/*@out@ */
 
 		if (*arg == '-') {
 			switch (arg[1]) {
+			case 'b':
+				if (strcmp(arg + 1, "bg") == 0) {
+					if (argc > (i + 1)) {
+						background = strdup_ordie(argv[i + 1]);
+						DMA(DEBUG_INFO, "new background: %s", foreground);
+						i++;
+						if (font == NULL)
+							font = DEFAULT_FONT;
+					}
+				}
+				break;
 			case 'd':
 				if (strcmp(arg + 1, "debug") == 0) {
 					debug_default = DEBUG_ALL;
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index 16dc4a3..78e278e 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -410,20 +410,22 @@ int loadFont(const char *fontname)
 }
 
 void drawString(int dest_x, int dest_y, const char *string,
-				const char *colorname, int right_justify)
+				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)
+void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname)
 {
-	XSetForeground(display, NormalGC, GetColor("black"));
+	XSetForeground(display, NormalGC, GetColor(bgcolorname));
 	XFillRectangle(display, wmgen_bkg.pixmap, NormalGC, x, y, x2 - x,
 				   y2 - y);
 }
diff --git a/wmgeneral/wmgeneral.h b/wmgeneral/wmgeneral.h
index ec6f4d2..f2f3595 100644
--- a/wmgeneral/wmgeneral.h
+++ b/wmgeneral/wmgeneral.h
@@ -61,8 +61,9 @@ 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, int right_justify);
-void eraseRect(int x, int y, int x2, int y2);
+				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

-- 
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