[Pkg-wmaker-commits] [wmbiff] 75/84: Allow automatic sizing of the wmbiff window, effective for other window managers.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:02:05 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 1fe268327929d726a490ca9c87e75a493d203ce2
Author: bluehal <bluehal>
Date: Tue Nov 12 08:27:44 2002 +0000
Allow automatic sizing of the wmbiff window, effective for other window managers.
---
Makefile.am | 6 +--
NEWS | 15 ++++++-
configure.ac | 5 +--
wmbiff/wmbiff.c | 110 +++++++++++++++++++++++++++++++++++++++++++-------
wmbiff/wmbiffrc.5.in | 27 +++++++++++--
wmgeneral/wmgeneral.c | 52 +++++++++++++++---------
wmgeneral/wmgeneral.h | 3 +-
7 files changed, 172 insertions(+), 46 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 285759d..6f84a59 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,12 +26,12 @@ indent:
cd wmgeneral && make indent
# manually increment version in configure.ac, which should be enough.
-ChangeLog: Makefile configure.ac
- @if test "x$(CVS2CL)" != "x"; then \
+ChangeLog: Makefile configure.ac
+ @if test "x$(CVS2CL)" != "x" && test -e maint/changelog.sed; then \
echo "Running $(CVS2CL)..."; \
$(CVS2CL) --stdout --utc --day-of-week -I TODO | \
sed -f maint/changelog.sed > $@; \
else \
echo "Unable to build ChangeLog for distribution"; \
- exit 1; \
+ exit 0; \
fi
diff --git a/NEWS b/NEWS
index 4811664..329c80b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,18 @@
Release Notes
~~~~~~~~~~~~~
+Release 0.4.9 -
+ * GNUTLS v0.5.9 or higher required
+ * Check TLS certificate hostname against the hostname we're
+ connecting to. This raises the bar, but does not make
+ wmbiff's TLS implementation secure.
+ * WMBiff scales to the number of mailboxes you're
+ using. For openbox, this means less wasted space in the
+ slit and the possibility of up to 40 mailboxes. For
+ WindowMaker, this means more pretty chrome and less dark
+ LED if you have only a couple boxes. If you prefer the empty
+ cells at the end, place "path.4=<space><space>" in your
+ .wmbiffrc.
+
Release 0.4.8 - Sept 18, 2002
* GNUTLS v0.5.1-0.5.6, gcrypt v1.1.8 required.
* Allow spaces in IMAP mailbox paths. The new syntax is:
@@ -356,4 +369,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.29 2002/09/18 23:43:49 bluehal Exp $
+$Id: NEWS,v 1.30 2002/11/12 08:27:44 bluehal Exp $
diff --git a/configure.ac b/configure.ac
index 0a6d844..45e168d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,10 +7,9 @@ dnl and configure:
dnl installation prefix
dnl version
-AC_INIT(wmbiff, 0.4.8, wmbiff-devel at lists.sourceforge.net)
+AC_INIT(wmbiff, 0.4.9pre, wmbiff-devel at lists.sourceforge.net)
AC_CONFIG_AUX_DIR(autoconf)
-AM_INIT_AUTOMAKE(wmbiff, 0.4.8)
-dnl AUTOHEADER="$AUTOHEADER -l \\\\\\\$\(srcdir)/autoconf"
+AM_INIT_AUTOMAKE(wmbiff, 0.4.9pre)
AM_CONFIG_HEADER(config.h)
dnl make sure autoheader finds version, implicitly defined above.
AH_TEMPLATE([VERSION], [wmbiff's release version])
diff --git a/wmbiff/wmbiff.c b/wmbiff/wmbiff.c
index f3a4b04..e40f4e6 100644
--- a/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff.c
@@ -1,4 +1,4 @@
-/* $Id: wmbiff.c,v 1.33 2002/07/18 02:55:24 bluehal Exp $ */
+/* $Id: wmbiff.c,v 1.34 2002/11/12 08:27:45 bluehal Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -38,7 +38,7 @@
#include "wmbiff-master-led.xpm"
char wmbiff_mask_bits[64 * 64];
const int wmbiff_mask_width = 64;
-const int wmbiff_mask_height = 64;
+// const int wmbiff_mask_height = 64;
#define CHAR_WIDTH 5
#define CHAR_HEIGHT 7
@@ -48,7 +48,9 @@ const int wmbiff_mask_height = 64;
#define BLINK_SLEEP_INTERVAL 200
#define DEFAULT_LOOP 5
-mbox_t mbox[5];
+#define MAX_NUM_MAILBOXES 40
+mbox_t mbox[MAX_NUM_MAILBOXES];
+
/* this is the normal pixmap. */
const char *skin_filename = "wmbiff-master-led.xpm";
/* path to search for pixmaps */
@@ -87,7 +89,7 @@ int debug_default = DEBUG_ERROR;
const char *foreground = "#21B3AF";
const char *highlight = "yellow";
-const int num_mailboxes = 5;
+int num_mailboxes = 1;
const int x_origin = 5;
const int y_origin = 5;
int forever = 1;
@@ -343,6 +345,67 @@ static int periodic_mail_check(void)
return Sleep_Interval;
}
+static int findTopOfMasterXPM(const char **skin_xpm)
+{
+ int i;
+ for (i = 0; skin_xpm[i] != NULL; i++) {
+ if (strstr(skin_xpm[i], "++++++++") != NULL)
+ return i;
+ }
+ DMA(DEBUG_ERROR,
+ "couldn't find the top of the xpm file using the simple method\n");
+ exit(EXIT_FAILURE);
+}
+
+static char **CreateBackingXPM(int width, int height,
+ const char **skin_xpm)
+{
+ char **ret = malloc(sizeof(char *) * (height + 6));
+ const int colors = 5;
+ const int base = colors + 1;
+ const int margin = 4;
+ int i;
+ int top = findTopOfMasterXPM(skin_xpm);
+ ret[0] = malloc(30);
+ 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[3] = (char *) "+\tc #000000"; /* shadowed */
+ ret[4] = (char *) "@\tc #C7C3C7"; /* highlight */
+ ret[5] = (char *) ":\tc #004941"; /* led off */
+ for (i = base; i < base + height; i++) {
+ ret[i] = malloc(width);
+ }
+ for (i = base; i < base + margin; i++) {
+ memset(ret[i], ' ', width);
+ }
+ for (i = base + margin; i < height + base - margin; i++) {
+ memset(ret[i], ' ', margin);
+
+ if (i == base + margin) {
+ memset(ret[i] + margin, '+', width - margin - margin);
+ } else if (i == base + height - margin - 1) {
+ memset(ret[i] + margin, '@', width - margin - margin);
+ } else {
+ // " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ "
+ // " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ " ",
+ ret[i][margin] = '+';
+ memset(ret[i] + margin + 1, '.', width - margin - margin - 1);
+ ret[i][width - margin - 1] = '@';
+ memcpy(ret[i],
+ skin_xpm[((i - (base + margin) - 1) % 11) + top + 1],
+ width);
+ }
+
+ memset(ret[i] + width - margin, ' ', margin);
+ }
+ for (i = base + height - margin; i < height + base; i++) {
+ memset(ret[i], ' ', width);
+ }
+ ret[i] = NULL; /* not sure if this is necessary, it just
+ seemed like a good idea */
+ return (ret);
+}
void do_biff(int argc, char **argv)
{
@@ -351,7 +414,12 @@ void do_biff(int argc, char **argv)
time_t curtime;
int Sleep_Interval = DEFAULT_SLEEP_INTERVAL; /* in msec */
const char **skin_xpm = NULL;
+ const char **bkg_xpm = NULL;
char *skin_file_path = search_path(skin_search_path, skin_filename);
+ int wmbiff_mask_height = mbox_y(num_mailboxes) + 4;
+
+ DMA(DEBUG_INFO, "running %d mailboxes w %d h %d\n", num_mailboxes,
+ wmbiff_mask_width, wmbiff_mask_height);
if (skin_file_path != NULL) {
skin_xpm = (const char **) LoadXPM(skin_file_path);
@@ -363,10 +431,14 @@ void do_biff(int argc, char **argv)
skin_xpm = wmbiff_master_xpm;
}
- createXBMfromXPM(wmbiff_mask_bits, skin_xpm,
+ bkg_xpm = (const char **) CreateBackingXPM(wmbiff_mask_width,
+ wmbiff_mask_height,
+ skin_xpm);
+
+ createXBMfromXPM(wmbiff_mask_bits, bkg_xpm,
wmbiff_mask_width, wmbiff_mask_height);
- openXwindow(argc, argv, skin_xpm, wmbiff_mask_bits,
+ openXwindow(argc, argv, bkg_xpm, skin_xpm, wmbiff_mask_bits,
wmbiff_mask_width, wmbiff_mask_height);
if (font != NULL) {
@@ -375,7 +447,8 @@ void do_biff(int argc, char **argv)
exit(EXIT_FAILURE);
}
/* make the whole background black */
- eraseRect(x_origin, y_origin, 58, 58);
+ eraseRect(x_origin, y_origin,
+ wmbiff_mask_width - 6, wmbiff_mask_height - 6);
}
/* First time setup of button regions and labels */
@@ -390,7 +463,7 @@ void do_biff(int argc, char **argv)
}
do {
- /* while (forever) { * forever is usually true,
+ /* while (forever) { * forever is usually true,
but not when debugging with -exit */
/* waitpid(0, NULL, WNOHANG); */
@@ -607,10 +680,10 @@ void ClearDigits(int i)
}
}
-/* Read a line from a file to obtain a pair setting=value
+/* Read a line from a file to obtain a pair setting=value
skips # and leading spaces
NOTE: if setting finish with 0, 1, 2, 3 or 4 last char are deleted and
- index takes its value... if not index will get -1
+ index takes its value... if not index will get -1
Returns -1 if no setting=value
*/
int ReadLine(FILE * fp, char *setting, char *value, int *mbox_index)
@@ -653,7 +726,7 @@ int ReadLine(FILE * fp, char *setting, char *value, int *mbox_index)
len = strlen(setting) - 1;
if (len > 0) {
aux = setting[len] - 48;
- if (aux > -1 && aux < num_mailboxes) {
+ if (aux > -1 && aux < MAX_NUM_MAILBOXES) {
setting[len] = 0;
*mbox_index = aux;
}
@@ -748,10 +821,10 @@ int Read_Config_File(char *filename, int *loopinterval)
} else if (!strcmp(setting, "askpass")) {
const char *askpass = strdup(value);
if (mbox_index == -1) {
+ int i;
DMA(DEBUG_INFO, "setting all to askpass %s\n", askpass);
- for (mbox_index = 0; mbox_index < num_mailboxes;
- mbox_index++)
- mbox[mbox_index].askpass = askpass;
+ for (i = 0; i < MAX_NUM_MAILBOXES; i++)
+ mbox[i].askpass = askpass;
} else {
mbox[mbox_index].askpass = askpass;
}
@@ -761,6 +834,15 @@ int Read_Config_File(char *filename, int *loopinterval)
certificate_filename = strdup(value);
} else if (mbox_index == -1)
continue; /* Didn't read any setting.[0-5] value */
+
+ if (mbox_index >= MAX_NUM_MAILBOXES) {
+ DMA(DEBUG_ERROR, "Don't have %d mailboxes.\n", mbox_index);
+ continue;
+ }
+ if (mbox_index + 1 > num_mailboxes
+ && mbox_index + 1 <= MAX_NUM_MAILBOXES) {
+ num_mailboxes = mbox_index + 1;
+ }
/* now only local settings */
if (!strcmp(setting, "label.")) {
strcpy(mbox[mbox_index].label, value);
diff --git a/wmbiff/wmbiffrc.5.in b/wmbiff/wmbiffrc.5.in
index 8e49abf..83a8217 100644
--- a/wmbiff/wmbiffrc.5.in
+++ b/wmbiff/wmbiffrc.5.in
@@ -1,5 +1,5 @@
.\" Hey, Emacs! This is an -*- nroff -*- source file.
-.\" $Id: wmbiffrc.5.in,v 1.8 2002/10/20 21:58:58 jordi Exp $
+.\" $Id: wmbiffrc.5.in,v 1.9 2002/11/12 08:27:47 bluehal Exp $
.\"
.\" @configure_input@
.\"
@@ -8,7 +8,7 @@
.\"
.\" This is free documentation, see the latest version of the GNU
.\" General Public License for copying conditions. There is NO warranty.
-.TH WMBIFFRC 5 "January 27, 2002" "wmbiff"
+.TH WMBIFFRC 5 "November 11, 2002" "wmbiff"
.SH NAME
wmbiffrc \- configuration file for
@@ -16,14 +16,15 @@ wmbiffrc \- configuration file for
.SH DESCRIPTION
\fBWMbiff\fP is a mail notification tool for the WindowMaker and AfterStep
-window managers. It can handle up to 5 mailboxes, and you can define actions
+window managers. It can handle up to 5 mailboxes, more when run using other
+window managers. You can define actions
on mouse clicks for the different mailboxes. This manpage explains the
different options which can be specified in a user's wmbiffrc.
.SH OPTIONS
Each option takes the form
.IR option[.mbox] " = " value .
-Comment must be preceeded by pound signs (#).
+Comments must be preceeded by pound signs (#).
The supported configuration options are:
@@ -201,6 +202,24 @@ supported values are "all" and "none". The \-debug option
to wmbiff overrides this setting. Since IMAP uses a single
connection per server, per-mailbox debugging may not
+.SH SIZING
+
+WMBiff will automatically size its window to the number of
+configured mailboxes. While WindowMaker's Dock and
+AfterStep's Wharf expect square, 64x64 applets, other window
+managers, such as Blackbox or Openbox do not have this
+limitation. This uncharacteristic "dockapp" behavior is
+intended to help those users who don't have exactly five
+mailboxes to watch.
+
+To preserve the old-style five-mailbox window even when you
+have only two, add
+.IR path.4=<space><space>
+to configure a blank 5th mailbox.
+
+To use the new-style sizing, just configure as many
+mailboxes as you want.
+
.SH AUTHENTICATION
Authentication methods include "cram-md5", "apop" (for
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index 4d87b38..caefcf5 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -75,7 +75,8 @@ Pixel back_pix, fore_pix;
const char *Geometry = "";
Window iconwin, win;
GC NormalGC;
-XpmIcon wmgen;
+XpmIcon wmgen_bkg;
+XpmIcon wmgen_src;
Pixmap pixmask;
/*****************/
@@ -189,6 +190,8 @@ static void GetXPM(XpmIcon * wmgen_local, const char *pixmap_bytes[])
/* 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);
@@ -199,7 +202,9 @@ static void GetXPM(XpmIcon * wmgen_local, const char *pixmap_bytes[])
&(wmgen_local->attributes));
if (err != XpmSuccess) {
- fprintf(stderr, "Not enough free colorcells.\n");
+ fprintf(stderr,
+ "Not enough free colorcells to create pixmap from data (err=%d).\n",
+ err);
exit(1);
}
}
@@ -249,11 +254,13 @@ void RedrawWindow(void)
{
flush_expose(iconwin);
- XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
- 0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
+ 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.pixmap, win, NormalGC,
- 0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
+ XCopyArea(display, wmgen_bkg.pixmap, win, NormalGC,
+ 0, 0, wmgen_bkg.attributes.width,
+ wmgen_bkg.attributes.height, 0, 0);
}
/*******************************************************************************\
@@ -264,11 +271,13 @@ 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);
+ 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.pixmap, win, NormalGC,
- x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
+ XCopyArea(display, wmgen_bkg.pixmap, win, NormalGC,
+ x, y, wmgen_bkg.attributes.width,
+ wmgen_bkg.attributes.height, 0, 0);
}
/*******************************************************************************\
@@ -367,8 +376,8 @@ void copyXPMArea(int src_x, int src_y, int width, int height, int dest_x,
int dest_y)
{
- XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, src_x, src_y,
- width, height, dest_x, dest_y);
+ XCopyArea(display, wmgen_src.pixmap, wmgen_bkg.pixmap, NormalGC, src_x,
+ src_y, width, height, dest_x, dest_y);
}
@@ -380,8 +389,8 @@ void copyXBMArea(int src_x, int src_y, int width, int height, int dest_x,
int dest_y)
{
- XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, src_x, src_y,
- width, height, dest_x, dest_y);
+ XCopyArea(display, wmgen_src.mask, wmgen_bkg.pixmap, NormalGC, src_x,
+ src_y, width, height, dest_x, dest_y);
}
@@ -409,14 +418,15 @@ void drawString(int dest_x, int dest_y, const char *string,
XSetForeground(display, NormalGC, GetColor(colorname));
if (right_justify)
dest_x -= XTextWidth(f, string, len);
- XDrawImageString(display, wmgen.pixmap, NormalGC, dest_x, dest_y,
+ XDrawImageString(display, wmgen_bkg.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);
+ XFillRectangle(display, wmgen_bkg.pixmap, NormalGC, x, y, x2 - x,
+ y2 - y);
}
/* end wmbiff additions */
@@ -437,7 +447,8 @@ void setMaskXY(int x, int y)
/*******************************************************************************\
|* openXwindow *|
\*******************************************************************************/
-void openXwindow(int argc, char *argv[], const char *pixmap_bytes[],
+void openXwindow(int argc, char *argv[], const char *pixmap_bytes_bkg[],
+ const char *pixmap_bytes_src[],
char *pixmask_bits, int pixmask_width, int pixmask_height)
{
@@ -477,7 +488,8 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[],
x_fd = XConnectionNumber(display);
/* Convert XPM to XImage */
- GetXPM(&wmgen, pixmap_bytes);
+ GetXPM(&wmgen_bkg, pixmap_bytes_bkg);
+ GetXPM(&wmgen_src, pixmap_bytes_src);
/* Create a window to hold the stuff */
mysizehints.flags = USSize | USPosition;
@@ -491,8 +503,8 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[],
&mysizehints.x, &mysizehints.y, &mysizehints.width,
&mysizehints.height, &dummy);
- mysizehints.width = 64;
- mysizehints.height = 64;
+ 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,
diff --git a/wmgeneral/wmgeneral.h b/wmgeneral/wmgeneral.h
index 75a8cfd..dfe79ec 100644
--- a/wmgeneral/wmgeneral.h
+++ b/wmgeneral/wmgeneral.h
@@ -46,7 +46,8 @@ void AddMouseRegion(int rgn_index, int left, int top, int right,
int bottom);
int CheckMouseRegion(int x, int y);
-void openXwindow(int argc, char *argv[], const char **, char *, int, int);
+void openXwindow(int argc, char *argv[], const char **,
+ const char **, char *, int, int);
void RedrawWindow(void);
void RedrawWindowXY(int x, int y);
--
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