From 70ef1da67c9ccb49677c0dc16f8bda54ca530198 Mon Sep 17 00:00:00 2001 From: hubertf Date: Tue, 27 Mar 2001 02:29:17 +0000 Subject: Update to wmnet-1.06nb1 to add some patches to make this work better in a fvwm2 FvwmButton (switches are mainly to set background color etc.) --- net/wmnet/patches/patch-ad | 174 ++++++++++++++++++++++++++++++++++++++++++++- net/wmnet/patches/patch-ae | 44 +++++++++++- net/wmnet/patches/patch-af | 15 ++++ 3 files changed, 228 insertions(+), 5 deletions(-) create mode 100644 net/wmnet/patches/patch-af (limited to 'net/wmnet/patches') diff --git a/net/wmnet/patches/patch-ad b/net/wmnet/patches/patch-ad index f7a2405c162..5d252a8e941 100644 --- a/net/wmnet/patches/patch-ad +++ b/net/wmnet/patches/patch-ad @@ -1,7 +1,7 @@ -$NetBSD: patch-ad,v 1.1 2000/07/31 17:02:25 tron Exp $ +$NetBSD: patch-ad,v 1.2 2001/03/27 02:29:18 hubertf Exp $ --- wmnet.c.orig Fri May 5 03:01:14 2000 -+++ wmnet.c Mon Jul 31 19:00:30 2000 ++++ wmnet.c @@ -55,7 +55,7 @@ #include #include @@ -11,3 +11,173 @@ $NetBSD: patch-ad,v 1.1 2000/07/31 17:02:25 tron Exp $ # include # include"getopt.h" #else +@@ -97,17 +97,19 @@ + int c; + XColor thecolor; + struct sigaction signal_action; +- char *txcolorString = NULL, *rxcolorString = NULL, *labelfgcolorString = NULL, *labelbgcolorString = NULL; ++ char *txcolorString = NULL, *rxcolorString = NULL, *labelfgcolorString = NULL, *labelbgcolorString = NULL, *bgcolorString = NULL; + char *parser = NULL; + #ifdef linux +- const struct option long_options[19] = { ++ const struct option long_options[21] = { + #else +- const struct option long_options[17] = { ++ const struct option long_options[19] = { + #endif + {"device", required_argument, NULL, 'W'}, + {"label", required_argument, NULL, 'L'}, + {"labelfg", required_argument, NULL, 'F'}, + {"labelbg", required_argument, NULL, 'B'}, ++ {"bg", required_argument, NULL, 'b'}, ++ {"no3d", no_argument, NULL, 'N'}, + {"logscale", no_argument, NULL, 'l'}, + {"help", no_argument, NULL, 'h'}, + {"execute", required_argument, NULL, 'e'}, +@@ -131,9 +133,9 @@ + + /* Get options */ + #ifdef linux +- while((c = getopt_long(argc, argv, "W:F:B:L:vp:u:wnle:R:T:r:t:D:d:x:h", long_options, NULL)) != EOF) { ++ while((c = getopt_long(argc, argv, "W:F:B:b:L:vp:u:wnNle:R:T:r:t:D:d:x:h", long_options, NULL)) != EOF) { + #else +- while((c = getopt_long(argc, argv, "W:F:B:L:vp:u:wnle:r:t:D:d:x:h", long_options, NULL)) != EOF) { ++ while((c = getopt_long(argc, argv, "W:F:B:b:L:vp:u:wnNle:r:t:D:d:x:h", long_options, NULL)) != EOF) { + #endif + switch(c) { + case 'v': +@@ -176,6 +178,15 @@ + exit(23); + } + break; ++ case 'b': ++ if (bgcolorString == NULL) { ++ bgcolorString = (char *)alloca(strlen(optarg)+1); ++ strncpy(bgcolorString, optarg, strlen(optarg)+1); ++ } else { ++ fprintf(stderr, "wmnet: duplicate --bg\n"); ++ exit(23); ++ } ++ break; + case 'F': + if (labelfgcolorString == NULL) { + labelfgcolorString = (char *)alloca(strlen(optarg)+1); +@@ -228,6 +239,9 @@ + case 'n': + specified_state = NormalState; + break; ++ case 'N': ++ no3d = True; ++ break; + case 'u': + { + int fds; +@@ -283,6 +297,7 @@ + " -L, --label=LABEL display LABEL on bottom of window\n" + " -F, --labelfg=COLOR foreground color for the label\n" + " -B, --labelbg=COLOR background color for the label\n" ++ " -b, --bg=COLOR background color\n" + " -e, --execute=COMMAND run COMMAND on click\n" + #ifdef linux + " -T, --txrule=RULE accounting rule number (ipfwadm) or\n" +@@ -320,6 +335,7 @@ + if (rxcolorString == NULL) rxcolorString = "red"; + if (labelfgcolorString == NULL) labelfgcolorString = "white"; + if (labelbgcolorString == NULL) labelbgcolorString = "black"; ++ if (bgcolorString == NULL) bgcolorString = "black"; + + /* Change dir to /, security precaution, and common courtesy */ + if (chdir("/") == -1) { +@@ -384,6 +400,14 @@ + XAllocColor(dpy, DefaultColormap(dpy, screen), &thecolor); + labelbg_pixel = thecolor.pixel; + } ++ if(bgcolorString) { ++ if(!XParseColor(dpy, DefaultColormap(dpy, screen), bgcolorString, &thecolor)) { ++ fprintf(stderr, "wmnet: what the heck is %s for a color?\n", bgcolorString); ++ exit(25); ++ } ++ XAllocColor(dpy, DefaultColormap(dpy, screen), &thecolor); ++ bg_pixel = thecolor.pixel; ++ } + + /* usleep() in between polls to /proc/net/ip_acct */ + if (delayTime <= 0) delayTime = 25000; +@@ -442,7 +466,7 @@ + } + gcv.graphics_exposures = False; + gcv.foreground = tx_pixel[HIGH_INTENSITY]; +- gcv.background = darkgrey_pixel; ++ gcv.background = bg_pixel /* HF: darkgrey_pixel */; + gcv.font = XLoadFont(dpy, "5x8"); + graphics_context = XCreateGC(dpy, root_window, (GCFont|GCGraphicsExposures|GCForeground|GCBackground), &gcv); + black_pixel = BlackPixel(dpy, screen); +@@ -494,12 +518,12 @@ + /* Handles Expose events, repaints the window */ + void redraw(XExposeEvent *ee) { + static XRectangle cliprect = { 4, 51, 56, 9 }; +- XSetForeground(dpy, graphics_context, darkgrey_pixel); ++ XSetForeground(dpy, graphics_context, bg_pixel /* HF: darkgrey_pixel*/); + /* if (wmaker_present == False) XFillRectangle(dpy, *visible_window, graphics_context, 0, 0, 64, 64); */ + XFillRectangle(dpy, *visible_window, graphics_context, GRAPHBOX_X, GRAPHBOX_Y, GRAPHBOX_WIDTH, GRAPHBOX_HEIGHT); + + +- XSetForeground(dpy, graphics_context, black_pixel); ++ XSetForeground(dpy, graphics_context, bg_pixel); + XFillRectangle(dpy, *visible_window, graphics_context, TOPBOX_X, TOPBOX_Y, TOPBOX_WIDTH, TOPBOX_HEIGHT); + XDrawLine(dpy, *visible_window, graphics_context, GRAPHBOX_X_LEFT, GRAPHBOX_Y_TOP, GRAPHBOX_X_LEFT, GRAPHBOX_Y_BOTTOM); + XDrawPoint(dpy, *visible_window, graphics_context, GRAPHBOX_X_RIGHT, GRAPHBOX_Y_TOP); +@@ -513,15 +537,19 @@ + } + + +- XSetForeground(dpy, graphics_context, white_pixel); +- XDrawLine(dpy, *visible_window, graphics_context, GRAPHBOX_X_RIGHT, GRAPHBOX_Y_BOTTOM, GRAPHBOX_X_RIGHT, (GRAPHBOX_Y_TOP + 1)); +- XDrawLine(dpy, *visible_window, graphics_context, GRAPHBOX_X_LEFT, GRAPHBOX_Y_BOTTOM, GRAPHBOX_X_RIGHT, GRAPHBOX_Y_BOTTOM); ++ if (! no3d) { ++ XSetForeground(dpy, graphics_context, white_pixel); ++ XDrawLine(dpy, *visible_window, graphics_context, GRAPHBOX_X_RIGHT, GRAPHBOX_Y_BOTTOM, GRAPHBOX_X_RIGHT, (GRAPHBOX_Y_TOP + 1)); ++ XDrawLine(dpy, *visible_window, graphics_context, GRAPHBOX_X_LEFT, GRAPHBOX_Y_BOTTOM, GRAPHBOX_X_RIGHT, GRAPHBOX_Y_BOTTOM); ++ } + + +- XSetForeground(dpy, graphics_context, grey_pixel); +- XSetBackground(dpy, graphics_context, black_pixel); +- XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); +- XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); ++ if (! no3d) { /* OK, this is cheating, but I don't want to add yet another switch; I have NFC what these arrows are for - HF */ ++ XSetForeground(dpy, graphics_context, grey_pixel); ++ XSetBackground(dpy, graphics_context, bg_pixel); ++ XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); ++ XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); ++ } + } + + +@@ -572,7 +600,7 @@ + if (blank < (GRAPH_WIDTH + 1) ) { + XCopyArea(dpy, *visible_window, *visible_window, graphics_context, GRAPH_X + 1, + GRAPH_Y, GRAPH_WIDTH - 1, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y); +- XSetForeground(dpy, graphics_context, darkgrey_pixel); ++ XSetForeground(dpy, graphics_context, bg_pixel /* HF: darkgrey_pixel*/ ); + XDrawLine(dpy, *visible_window, graphics_context, GRAPH_X_RIGHT, y, GRAPH_X_RIGHT, yy); + if (( (yy == GRAPH_Y_UPPER && diffbytes_out > 0 && rate_rx > rate_tx) || (rate_rx >= rate_tx && yy != GRAPH_Y_UPPER)) ) { + drawColoredLine(GRAPH_Y_UPPER, yy, tx_pixel); +@@ -593,7 +621,7 @@ + if (!stat_gather()) { /* Anything change? */ + current_rx = rx; + current_tx = tx; +- XSetBackground(dpy, graphics_context, black_pixel); ++ XSetBackground(dpy, graphics_context, bg_pixel); + if(current_tx == True) { + XSetForeground(dpy, graphics_context, tx_pixel[HIGH_INTENSITY]); + XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); +@@ -646,7 +674,7 @@ + + + if (!clear) { +- XSetForeground(dpy, graphics_context, black_pixel); ++ XSetForeground(dpy, graphics_context, bg_pixel); + XFillRectangle(dpy, *visible_window, graphics_context, 4, 5, 37, 9); + } + if (rate < .1) { diff --git a/net/wmnet/patches/patch-ae b/net/wmnet/patches/patch-ae index 223f1af1adc..cf44a87f1de 100644 --- a/net/wmnet/patches/patch-ae +++ b/net/wmnet/patches/patch-ae @@ -1,8 +1,46 @@ -$NetBSD: patch-ae,v 1.2 2000/08/02 00:01:24 wiz Exp $ +$NetBSD: patch-ae,v 1.3 2001/03/27 02:29:18 hubertf Exp $ --- wmnet.man.orig Fri May 5 02:43:35 2000 -+++ wmnet.man Mon Jul 31 19:00:30 2000 -@@ -147,9 +147,9 @@ ++++ wmnet.man +@@ -1,6 +1,6 @@ + .\" -*-Nroff-*- + .\" +-.TH wmnet 1x "4 May 2000" ++.TH wmnet 1x "4 Mar 2001" + .SH NAME + wmnet \- an IP accounting monitoring tool + .SH SYNOPSIS +@@ -17,6 +17,7 @@ + .RB [\| -F,--labelfg=\fICOLOR \|] + .RB [\| -B,--labelbg=\fICOLOR \|] + .RB [\| -L,--label=\fILABEL \|] ++.RB [\| -b,--bg=\fICOLOR \|] + .RB [\| -e,--execute=\fICOMMAND \|] + .RB [\| -p,--promisc=\fIDEVICE \|] + .RB [\| -u,--unpromisc=\fIDEVICE \|] +@@ -82,6 +83,10 @@ + .B -B,--labelbg=\fICOLOR + specifies the color for the background of the label text + .TP ++.B -b,--bg=\fICOLOR ++specifies the color for the background of WMnet. For use with other ++window managers than Window Maker. See also the -N switch. ++.TP + .B --withdrawn + .TP + .B --normalstate +@@ -90,6 +95,10 @@ + defined atom is present, and in normalstate otherwise. This behavior is + overriden by specifying one of these options. + .TP ++.B -N,--no3d ++Switch off pseudo 3D look. For use with other window managers than ++Window Maker. See also the -b switch. ++.TP + .B -e,--execute=\fICOMMAND + executes \fICOMMAND \fPon a single click from button 1 (left mouse button). + .TP +@@ -147,9 +156,9 @@ Otherwise, the kernel will not collect the stats we need. .TP .B kmem diff --git a/net/wmnet/patches/patch-af b/net/wmnet/patches/patch-af new file mode 100644 index 00000000000..5d0cfd7647c --- /dev/null +++ b/net/wmnet/patches/patch-af @@ -0,0 +1,15 @@ +$NetBSD: patch-af,v 1.1 2001/03/27 02:29:18 hubertf Exp $ + +--- wmnet.h.orig Sun Mar 4 02:39:16 2001 ++++ wmnet.h +@@ -68,8 +68,9 @@ + Pixmap arrow; + Atom delete_atom; + int screen, specified_state = -1; ++int no3d = 0; /* 3d shadow look by default */ + GC graphics_context; +-unsigned long tx_pixel[3], rx_pixel[3], labelfg_pixel, labelbg_pixel, black_pixel, white_pixel, darkgrey_pixel, grey_pixel; ++unsigned long tx_pixel[3], rx_pixel[3], labelfg_pixel, labelbg_pixel, bg_pixel, black_pixel, white_pixel, darkgrey_pixel, grey_pixel; + typedef int (*parser_func)(void); + + /* I know statically declared buffers are against GNU coding standards, so sue me */ -- cgit v1.2.3