wmgeneral: Bump to 1998-09-14 version found in wmckgmail, wmitime, wmsmp.app, wmSMPmon, and wmtz.

Note that wmckgmail and wmtz were identical; this is the version we use.
wmSMPmon differed only with some whitespace.

wmitime differed only with a bugfix (a segfault when -display is given with
no argument), but this will be fixed again in the next commit.

wmsm.app had patched wmgeneral to work with its xpm; instead we patch its
xpm to work with wmgeneral.
This commit is contained in:
Doug Torrance 2015-05-19 22:30:48 -05:00 committed by Carlos R. Mafra
parent 6c8c14e710
commit a680f87666
9 changed files with 246 additions and 179 deletions

View file

@ -92,9 +92,9 @@ void RedrawWindow(void);
void AddMouseRegion(int, int, int, int, int); void AddMouseRegion(int, int, int, int, int);
int CheckMouseRegion(int, int); int CheckMouseRegion(int, int);
/*****************************************************************************\ /*******************************************************************************\
|* parse_rcfile *| |* parse_rcfile *|
\*****************************************************************************/ \*******************************************************************************/
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
@ -127,9 +127,9 @@ void parse_rcfile(const char *filename, rckeys *keys) {
} }
} }
/***************************************************************************\ /*******************************************************************************\
|* parse_rcfile2 *| |* parse_rcfile2 *|
\***************************************************************************/ \*******************************************************************************/
void parse_rcfile2(const char *filename, rckeys2 *keys) { void parse_rcfile2(const char *filename, rckeys2 *keys) {
@ -161,9 +161,9 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
} }
/***************************************************************************\ /*******************************************************************************\
|* GetXPM *| |* GetXPM *|
\***************************************************************************/ \*******************************************************************************/
static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) { static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
@ -184,9 +184,9 @@ static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
} }
} }
/***************************************************************************\ /*******************************************************************************\
|* GetColor *| |* GetColor *|
\***************************************************************************/ \*******************************************************************************/
static Pixel GetColor(char *name) { static Pixel GetColor(char *name) {
@ -204,9 +204,9 @@ static Pixel GetColor(char *name) {
return color.pixel; return color.pixel;
} }
/***************************************************************************\ /*******************************************************************************\
|* flush_expose *| |* flush_expose *|
\***************************************************************************/ \*******************************************************************************/
static int flush_expose(Window w) { static int flush_expose(Window w) {
@ -219,9 +219,9 @@ static int flush_expose(Window w) {
return i; return i;
} }
/***************************************************************************\ /*******************************************************************************\
|* RedrawWindow *| |* RedrawWindow *|
\***************************************************************************/ \*******************************************************************************/
void RedrawWindow(void) { void RedrawWindow(void) {
@ -233,9 +233,9 @@ void RedrawWindow(void) {
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0); 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
} }
/***************************************************************************\ /*******************************************************************************\
|* RedrawWindowXY *| |* RedrawWindowXY *|
\***************************************************************************/ \*******************************************************************************/
void RedrawWindowXY(int x, int y) { void RedrawWindowXY(int x, int y) {
@ -247,9 +247,9 @@ void RedrawWindowXY(int x, int y) {
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0); x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
} }
/***************************************************************************\ /*******************************************************************************\
|* AddMouseRegion *| |* AddMouseRegion *|
\***************************************************************************/ \*******************************************************************************/
void AddMouseRegion(int index, int left, int top, int right, int bottom) { void AddMouseRegion(int index, int left, int top, int right, int bottom) {
@ -262,9 +262,9 @@ void AddMouseRegion(int index, int left, int top, int right, int bottom) {
} }
} }
/***************************************************************************\ /*******************************************************************************\
|* CheckMouseRegion *| |* CheckMouseRegion *|
\***************************************************************************/ \*******************************************************************************/
int CheckMouseRegion(int x, int y) { int CheckMouseRegion(int x, int y) {
@ -285,38 +285,41 @@ int CheckMouseRegion(int x, int y) {
return (i-1); return (i-1);
} }
/***************************************************************************\ /*******************************************************************************\
|* createXBMfromXPM *| |* createXBMfromXPM *|
\***************************************************************************/ \*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) { void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero = 0; int zero=0;
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); 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++) { for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j = 0; j < sx * depth; j += depth) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
curpixel=0; curpixel=0;
for (k = 0; k != depth; k++) { for (k=0; k!=depth; k++)
curpixel <<=8; {
curpixel |= xpm[i][j+k]; curpixel <<=8;
} curpixel |= xpm[i][j+k];
}
if (curpixel != zero) { if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
bcount++; bcount++;
@ -330,69 +333,56 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
} }
/***************************************************************************\ /*******************************************************************************\
|* copyXPMArea *| |* copyXPMArea *|
|* *| \*******************************************************************************/
|* copies pixel area from master XPM to application window *|
|* *| void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
|* x,y: first corner of area to be copied from master XPM *|
|* sx,sy: second corner of area to be copied from master XPM *| XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|* dx,dy: first corner of target area *|
\***************************************************************************/
void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy)
{
XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC,
x, y, sx, sy, dx, dy);
} }
/***************************************************************************\ /*******************************************************************************\
|* copyXBMArea *| |* copyXBMArea *|
|* *| \*******************************************************************************/
|* copies pixel area from XBM to master XPM?!?!? *|
|* *|
|* x,y: first corner of area to be copied from XBM *|
|* sx,sy: width and height of area to be copied from XBM *|
|* dx,dy: first corner of target area *|
\***************************************************************************/
void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
{
XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
x, y, sx, sy, dx, dy);
} }
/***************************************************************************\ /*******************************************************************************\
|* setMaskXY *| |* setMaskXY *|
\***************************************************************************/ \*******************************************************************************/
void setMaskXY(int x, int y) void setMaskXY(int x, int y) {
{
XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet); XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet); XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
} }
/***************************************************************************\ /*******************************************************************************\
|* openXwindow *| |* openXwindow *|
\***************************************************************************/ \*******************************************************************************/
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) { void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
unsigned int borderwidth = 1; unsigned int borderwidth = 1;
XClassHint classHint; XClassHint classHint;
char *display_name = NULL; char *display_name = NULL;
char *wname = argv[0]; char *wname = argv[0];
XTextProperty name; XTextProperty name;
XGCValues gcv; XGCValues gcv;
unsigned long gcm; unsigned long gcm;
char *geometry = NULL; char *geometry = NULL;
int dummy=0; int dummy=0;
int i, wx, wy; int i, wx, wy;
for (i = 1; argv[i]; i++) { for (i=1; argv[i]; i++) {
if (!strcmp(argv[i], "-display")) { if (!strcmp(argv[i], "-display")) {
display_name = argv[i+1]; display_name = argv[i+1];
i++; i++;
@ -405,7 +395,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
if (!(display = XOpenDisplay(display_name))) { if (!(display = XOpenDisplay(display_name))) {
fprintf(stderr, "%s: can't open display %s\n", fprintf(stderr, "%s: can't open display %s\n",
wname, XDisplayName(display_name)); wname, XDisplayName(display_name));
exit(1); exit(1);
} }
screen = DefaultScreen(display); screen = DefaultScreen(display);
@ -425,19 +415,16 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
fore_pix = GetColor("black"); fore_pix = GetColor("black");
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
&mysizehints.x, &mysizehints.y, &mysizehints.width, &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
&mysizehints.height, &dummy);
mysizehints.width = 64; mysizehints.width = 64;
mysizehints.height = 64; mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.x, mysizehints.y, mysizehints.width, mysizehints.height, mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
borderwidth, fore_pix, back_pix);
/* Activate hints */ /* Activate hints */
XSetWMNormalHints(display, win, &mysizehints); XSetWMNormalHints(display, win, &mysizehints);

View file

@ -11,7 +11,10 @@
--- ---
CHANGES: CHANGES:
--- ---
14/09/1998 (Dave Clark, clarkd@skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Removed a bug from parse_rcfile. You could * Removed a bug from parse_rcfile. You could
not use "start" in a command if a label was not use "start" in a command if a label was
@ -287,22 +290,36 @@ int CheckMouseRegion(int x, int y) {
\*******************************************************************************/ \*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) { void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j; int i,j,k;
int width, height, numcol; int width, height, numcol, depth;
char zero; int zero=0;
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
sscanf(*xpm, "%d %d %d", &width, &height, &numcol); for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
zero = xpm[1][0];
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx; j++) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
if (xpm[i][j] != zero) {
curpixel=0;
for (k=0; k!=depth; k++)
{
curpixel <<=8;
curpixel |= xpm[i][j+k];
}
if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
bcount++; bcount++;

View file

@ -11,7 +11,10 @@
--- ---
CHANGES: CHANGES:
--- ---
14/09/1998 (Dave Clark, clarkd@skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Removed a bug from parse_rcfile. You could * Removed a bug from parse_rcfile. You could
not use "start" in a command if a label was not use "start" in a command if a label was
@ -287,22 +290,36 @@ int CheckMouseRegion(int x, int y) {
\*******************************************************************************/ \*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) { void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j; int i,j,k;
int width, height, numcol; int width, height, numcol, depth;
char zero; int zero=0;
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
sscanf(*xpm, "%d %d %d", &width, &height, &numcol); for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
zero = xpm[1][0];
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx; j++) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
if (xpm[i][j] != zero) {
curpixel=0;
for (k=0; k!=depth; k++)
{
curpixel <<=8;
curpixel |= xpm[i][j+k];
}
if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
bcount++; bcount++;

View file

@ -11,7 +11,10 @@
--- ---
CHANGES: CHANGES:
--- ---
14/09/1998 (Dave Clark, clarkd@skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Removed a bug from parse_rcfile. You could * Removed a bug from parse_rcfile. You could
not use "start" in a command if a label was not use "start" in a command if a label was
@ -287,22 +290,36 @@ int CheckMouseRegion(int x, int y) {
\*******************************************************************************/ \*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) { void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j; int i,j,k;
int width, height, numcol; int width, height, numcol, depth;
char zero; int zero=0;
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
sscanf(*xpm, "%d %d %d", &width, &height, &numcol); for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
zero = xpm[1][0];
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx; j++) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
if (xpm[i][j] != zero) {
curpixel=0;
for (k=0; k!=depth; k++)
{
curpixel <<=8;
curpixel |= xpm[i][j+k];
}
if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
bcount++; bcount++;

View file

@ -385,11 +385,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
for (i=1; argv[i]; i++) { for (i=1; argv[i]; i++) {
if (!strcmp(argv[i], "-display")) { if (!strcmp(argv[i], "-display")) {
display_name = argv[i+1]; display_name = argv[i+1];
if (!display_name) i++;
printf("Please provide an argument for "
"-display.\n");
else
i++;
} }
if (!strcmp(argv[i], "-geometry")) { if (!strcmp(argv[i], "-geometry")) {
geometry = argv[i+1]; geometry = argv[i+1];

View file

@ -11,7 +11,10 @@
--- ---
CHANGES: CHANGES:
--- ---
14/09/1998 (Dave Clark, clarkd@skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Removed a bug from parse_rcfile. You could * Removed a bug from parse_rcfile. You could
not use "start" in a command if a label was not use "start" in a command if a label was
@ -287,22 +290,36 @@ int CheckMouseRegion(int x, int y) {
\*******************************************************************************/ \*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) { void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j; int i,j,k;
int width, height, numcol; int width, height, numcol, depth;
char zero; int zero=0;
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
sscanf(*xpm, "%d %d %d", &width, &height, &numcol); for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
zero = xpm[1][0];
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx; j++) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
if (xpm[i][j] != zero) {
curpixel=0;
for (k=0; k!=depth; k++)
{
curpixel <<=8;
curpixel |= xpm[i][j+k];
}
if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
bcount++; bcount++;

View file

@ -11,7 +11,10 @@
--- ---
CHANGES: CHANGES:
--- ---
14/09/1998 (Dave Clark, clarkd@skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Removed a bug from parse_rcfile. You could * Removed a bug from parse_rcfile. You could
not use "start" in a command if a label was not use "start" in a command if a label was
@ -287,22 +290,36 @@ int CheckMouseRegion(int x, int y) {
\*******************************************************************************/ \*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) { void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j; int i,j,k;
int width, height, numcol; int width, height, numcol, depth;
char zero; int zero=0;
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
sscanf(*xpm, "%d %d %d", &width, &height, &numcol); for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
zero = xpm[1][0];
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx; j++) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
if (xpm[i][j] != zero) {
curpixel=0;
for (k=0; k!=depth; k++)
{
curpixel <<=8;
curpixel |= xpm[i][j+k];
}
if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
bcount++; bcount++;

View file

@ -303,34 +303,34 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
for (k=0; k!=depth; k++) for (k=0; k!=depth; k++)
{ {
zero <<=8; zero <<=8;
zero |= xpm[2][k]; zero |= xpm[1][k];
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1; bwrite >>= 1;
curpixel=0; curpixel=0;
for (k=0; k!=depth; k++) for (k=0; k!=depth; k++)
{ {
curpixel <<=8; curpixel <<=8;
curpixel |= xpm[i][j+k]; curpixel |= xpm[i][j+k];
} }
if ( curpixel != zero ) { if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
}
bcount++;
if (bcount == 8) {
*xbm = bwrite;
xbm++;
bcount = 0;
bwrite = 0;
}
} }
bcount++; }
if (bcount == 8) {
*xbm = bwrite;
xbm++;
bcount = 0;
bwrite = 0;
}
}
}
} }
/*******************************************************************************\ /*******************************************************************************\
@ -411,7 +411,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
mysizehints.x = 0; mysizehints.x = 0;
mysizehints.y = 0; mysizehints.y = 0;
back_pix = GetColor("black"); back_pix = GetColor("white");
fore_pix = GetColor("black"); fore_pix = GetColor("black");
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,

View file

@ -1,7 +1,6 @@
/* XPM */ /* XPM */
static char * wmsm_master_xpm[] = { static char * wmsm_master_xpm[] = {
"116 87 81 1", "116 87 80 1",
" c None",
". c #0000FF", ". c #0000FF",
"+ c #202020", "+ c #202020",
"@ c #007D71", "@ c #007D71",