jv@mh.nl (Johan Vromans) (11/17/90)
This is a set of fixes for tvtwm to compile under X11R3. It has been updated for patchlevel 4, but will probably work for patchlevel 3 as well. It creates a (local) subdirectory X11/Xmu and X11/bitmaps to hold some of the X11R4 include files, and supplies two missing subroutines (also copied from X11R4). A pre-configured "Makefile.local" is supplied. It is set for GCC, so you might want/need to change it (or supply "CC=cc" with the "make"). The only source file modified is "util.c", using "#ifdef X11R3" conditionals. After this patch, a regular "imake" will still do a X11R4 build, but "make -f Makefile.local" will do a X11R3 build. Credits: some of the work has been done by Jon Block, jon@nucleus.mi.org. ================ changed files ================ util.c # changed bitmap lookup ================ new files ================ Makefile.local # massaged from imaked Makefile ./X11/Xmu/CharSet.h # stolen from X11R4 ./X11/Xmu/Drawing.h # stolen from X11R4 ./X11/bitmaps/menu12 # local artwork DrawLogo.c # stolen from X11R4 Lower.c # stolen from X11R4 ================ end of hype ================ *** /dev/null Wed Oct 17 15:45:06 1990 --- Makefile.local Wed Oct 17 15:45:06 1990 *************** *** 0 --- 1,143 ----- + CC = gcc + MV = mv + RM = rm -f + SHELL = /bin/sh + + # architecture specific flags + # hp9000 hpux6.5 x11r4 + #A_CFLAGS = -Wc,-Nd4000,-Ns3300,-Ne700,-Np200 -DSYSV + # sun3 sunos4.03 x11r4 + #A_CFLAGS = + # ibm032 acis4.3 x11r4 + #A_CFLAGS = -DSIGNALRETURNSINT -DNOPUTENV + + CFLAGS = -O -DX11R3 -I. -I/usr/include/mit ${A_CFLAGS} + + YFLAGS = -d + DIFF = gram.y lex.l add_window.c gc.c list.c twm.c \ + parse.c menus.c events.c resize.c util.c version.c iconmgr.c \ + cursor.c icons.c desktop.c + SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c \ + parse.c menus.c events.c resize.c util.c version.c iconmgr.c \ + cursor.c icons.c desktop.c move.c vdt.c Lower.c DrawLogo.c + OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o \ + parse.o menus.o events.o resize.o util.o version.o iconmgr.o \ + cursor.o icons.o move.o vdt.o Lower.o DrawLogo.o + INCS = add_window.h dekstop.h desktop.h events.h gc.h iconmgr.h icons.h \ + list.h menus.h parse.h resize.h screen.h twm.h util.h version.h + + LIBS = -lXmu -lX11 -lXext + + all: twm + + twm: $(OBJS) + $(CC) $(CFLAGS) -o twm $(OBJS) $(LIBS) + + gram.h gram.c: gram.y + yacc $(YFLAGS) gram.y + $(MV) y.tab.c gram.c + $(MV) y.tab.h gram.h + + clean: + $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c ${OBJS} + + deftwmrc.c: system.twmrc + $(RM) $@ + echo '/* ' >>$@ + echo ' * This file is generated automatically from the default' >>$@ + echo ' * twm bindings file system.twmrc by the twm Imakefile.' >>$@ + echo ' */' >>$@ + echo '' >>$@ + echo 'char *defTwmrc[] = {' >>$@ + sed -e '/^#/d' -e 's/"/\\"/g' -e 's/^/ "/' -e 's/$$/",/' \ + system.twmrc >>$@ + echo ' (char *) 0 };' >>$@ + + diffs: + ./makediff 1.1 ${DIFF} + @echo 'Now go in and remove the chaff from diffs.' + + depend: gram.c gram.h lex.c + makedepend ${SRCS} ${INCS} + + # DO NOT DELETE THIS LINE -- make depend depends on it. + + gram.o: /usr/include/stdio.h /usr/include/ctype.h twm.h + gram.o: /usr/include/X11/Xlib.h /usr/include/sys/types.h /usr/include/X11/X.h + gram.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h menus.h list.h + gram.o: util.h screen.h iconmgr.h parse.h /usr/include/X11/Xos.h + gram.o: /usr/include/strings.h /usr/include/sys/file.h /usr/include/fcntl.h + gram.o: /usr/include/sys/time.h + lex.o: /usr/include/stdio.h gram.h parse.h + add_window.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + add_window.o: /usr/include/sys/types.h /usr/include/X11/X.h + add_window.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h + add_window.o: /usr/include/X11/Xatom.h add_window.h util.h resize.h parse.h + add_window.o: list.h events.h menus.h screen.h iconmgr.h + gc.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + gc.o: /usr/include/sys/types.h /usr/include/X11/X.h /usr/include/X11/Xutil.h + gc.o: /usr/include/X11/cursorfont.h util.h screen.h list.h menus.h iconmgr.h + list.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + list.o: /usr/include/sys/types.h /usr/include/X11/X.h + list.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h screen.h + list.o: list.h menus.h iconmgr.h gram.h + twm.o: /usr/include/stdio.h /usr/include/signal.h /usr/include/sys/signal.h + twm.o: /usr/include/fcntl.h twm.h /usr/include/X11/Xlib.h + twm.o: /usr/include/sys/types.h /usr/include/X11/X.h /usr/include/X11/Xutil.h + twm.o: /usr/include/X11/cursorfont.h add_window.h gc.h parse.h version.h + twm.o: menus.h events.h util.h gram.h screen.h list.h iconmgr.h + twm.o: /usr/include/X11/Xproto.h /usr/include/X11/Xmd.h + twm.o: /usr/include/X11/Xprotostr.h + parse.o: /usr/include/stdio.h /usr/include/X11/Xos.h /usr/include/sys/types.h + parse.o: /usr/include/strings.h /usr/include/sys/file.h /usr/include/fcntl.h + parse.o: /usr/include/sys/time.h twm.h + parse.o: /usr/include/X11/Xlib.h /usr/include/X11/X.h + parse.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h screen.h + parse.o: list.h menus.h iconmgr.h util.h gram.h parse.h + menus.o: /usr/include/stdio.h /usr/include/signal.h /usr/include/sys/signal.h + menus.o: /usr/include/X11/Xos.h /usr/include/sys/types.h + menus.o: /usr/include/strings.h /usr/include/sys/file.h /usr/include/fcntl.h + menus.o: /usr/include/sys/time.h twm.h /usr/include/X11/Xlib.h + menus.o: /usr/include/X11/X.h /usr/include/X11/Xutil.h + menus.o: /usr/include/X11/cursorfont.h gc.h menus.h resize.h events.h util.h + menus.o: parse.h gram.h screen.h list.h iconmgr.h + menus.o: /usr/include/X11/bitmaps/scales version.h + events.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + events.o: /usr/include/sys/types.h /usr/include/X11/X.h + events.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h + events.o: /usr/include/X11/Xatom.h add_window.h menus.h events.h resize.h + events.o: parse.h gram.h util.h screen.h list.h iconmgr.h version.h + resize.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + resize.o: /usr/include/sys/types.h /usr/include/X11/X.h + resize.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h parse.h + resize.o: util.h resize.h add_window.h screen.h list.h menus.h iconmgr.h + util.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + util.o: /usr/include/sys/types.h /usr/include/X11/X.h + util.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h util.h gram.h + util.o: screen.h list.h menus.h iconmgr.h /usr/include/X11/Xos.h + util.o: /usr/include/strings.h /usr/include/sys/file.h /usr/include/fcntl.h + util.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h + iconmgr.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + iconmgr.o: /usr/include/sys/types.h /usr/include/X11/X.h + iconmgr.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h util.h + iconmgr.o: parse.h screen.h list.h menus.h iconmgr.h resize.h add_window.h + iconmgr.o: siconify.bm /usr/include/X11/Xos.h /usr/include/strings.h + iconmgr.o: /usr/include/sys/file.h /usr/include/fcntl.h + iconmgr.o: /usr/include/sys/time.h + cursor.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + cursor.o: /usr/include/sys/types.h /usr/include/X11/X.h + cursor.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h + cursor.o: /usr/include/X11/Xos.h /usr/include/strings.h + cursor.o: /usr/include/sys/file.h /usr/include/fcntl.h + cursor.o: /usr/include/sys/time.h screen.h list.h menus.h iconmgr.h util.h + icons.o: /usr/include/stdio.h twm.h /usr/include/X11/Xlib.h + icons.o: /usr/include/sys/types.h /usr/include/X11/X.h + icons.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h screen.h + icons.o: list.h menus.h iconmgr.h icons.h gram.h parse.h util.h + lex.o: /usr/include/stdio.h gram.h parse.h + screen.o: /usr/include/X11/Xlib.h /usr/include/sys/types.h + screen.o: /usr/include/X11/X.h /usr/include/X11/Xutil.h + screen.o: /usr/include/X11/cursorfont.h list.h menus.h iconmgr.h + twm.o: /usr/include/X11/Xlib.h /usr/include/sys/types.h /usr/include/X11/X.h + twm.o: /usr/include/X11/Xutil.h /usr/include/X11/cursorfont.h + *** /dev/null Wed Oct 17 15:45:06 1990 --- X11/Xmu/CharSet.h Wed Oct 17 15:46:03 1990 *************** *** 0 --- 1,28 ----- + /* + * $XConsortium: CharSet.h,v 1.2 89/09/22 15:33:14 jim Exp $ + * + * Copyright 1988 by the Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * The X Window System is a Trademark of MIT. + * + * The interfaces described by this header file are for miscellaneous utilities + * and are not part of the Xlib standard. + */ + + #ifndef _XMU_CHARSET_H_ + #define _XMU_CHARSET_H_ + + extern void XmuCopyISOLatin1Lowered(); + extern void XmuCopyISOLatin1Uppered(); + extern int XmuCompareISOLatin1(); + #endif /* _XMU_CHARSET_H_ */ *** /dev/null Wed Oct 17 15:45:06 1990 --- X11/Xmu/Drawing.h Wed Oct 17 15:46:04 1990 *************** *** 0 --- 1,33 ----- + /* + * $XConsortium: Drawing.h,v 1.3 89/10/03 08:37:53 rws Exp $ + * + * Copyright 1988 by the Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * The X Window System is a Trademark of MIT. + * + * The interfaces described by this header file are for miscellaneous utilities + * and are not part of the Xlib standard. + */ + + #ifndef _XMU_DRAWING_H_ + #define _XMU_DRAWING_H_ + + void XmuDrawRoundedRectangle(); + void XmuFillRoundedRectangle(); + void XmuDrawLogo(); + Pixmap XmuCreatePixmapFromBitmap(); + Pixmap XmuCreateStippledPixmap(); + Pixmap XmuLocateBitmapFile(); + int XmuReadBitmapData(), XmuReadBitmapDataFromFile(); + + #endif /* _XMU_DRAWING_H_ */ *** /dev/null Wed Oct 17 15:45:06 1990 --- X11/bitmaps/menu12 Wed Oct 17 15:46:24 1990 *************** *** 0 --- 1,5 ----- + #define menu12_width 16 + #define menu12_height 12 + static char menu12_bits[] = { + 0x00, 0x00, 0x3f, 0x06, 0x03, 0x0c, 0x03, 0x18, 0x03, 0x30, 0x03, 0x60, + 0xf3, 0xff, 0x03, 0x60, 0x03, 0x30, 0x03, 0x18, 0x03, 0x0c, 0x3f, 0x06}; *** util.c~ Wed Oct 17 15:46:40 1990 --- util.c Wed Oct 17 15:46:40 1990 *************** *** 356,362 */ bigname = ExpandFilename (name); if (!bigname) return None; ! /* * look along bitmapFilePath resource same as toolkit clients */ --- 356,362 ----- */ bigname = ExpandFilename (name); if (!bigname) return None; ! #ifndef X11R3 /* * look along bitmapFilePath resource same as toolkit clients */ *************** *** 363,368 pm = XmuLocateBitmapFile (ScreenOfDisplay(dpy, Scr->screen), bigname, NULL, 0, widthp, heightp, &HotX, &HotY); if (pm == None && Scr->IconDirectory && bigname[0] != '/') { if (bigname != name) free (bigname); /* * Attempt to find icon in old IconDirectory (now obsolete) --- 363,373 ----- pm = XmuLocateBitmapFile (ScreenOfDisplay(dpy, Scr->screen), bigname, NULL, 0, widthp, heightp, &HotX, &HotY); if (pm == None && Scr->IconDirectory && bigname[0] != '/') { + #else + if (XReadBitmapFile (dpy, Scr->Root, bigname, + widthp, heightp, &pm, &HotX, &HotY) != BitmapSuccess && + Scr->IconDirectory && name[0] != '/') { + #endif if (bigname != name) free (bigname); /* * Attempt to find icon in old IconDirectory (now obsolete) *** /dev/null Wed Oct 17 15:45:06 1990 --- DrawLogo.c Wed Oct 17 15:45:06 1990 *************** *** 0 --- 1,150 ----- + #ifndef lint + static char Xrcsid[] = "$XConsortium: DrawLogo.c,v 1.1 89/05/11 14:01:55 kit Exp $"; + #endif + + #include <X11/Xlib.h> + + /* + Copyright 1988 by the Massachusetts Institute of Technology + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright + notice and this permission notice appear in supporting + documentation, and that the name of M.I.T. not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + M.I.T. makes no representations about the suitability of + this software for any purpose. It is provided "as is" + without express or implied warranty. + */ + + /* + * Draw the "official" X Window System Logo, designed by Danny Chong + * + * Written by Ollie Jones, Apollo Computer + * + * Does some fancy stuff to make the logo look acceptable even + * if it is tiny. Also makes the various linear elements of + * the logo line up as well as possible considering rasterization. + */ + + XmuDrawLogo(dpy, drawable, gcFore, gcBack, x, y, width, height) + Display *dpy; + Drawable drawable; + GC gcFore, gcBack; + int x, y; + unsigned int width, height; + { + + unsigned int size; + int d11, d21, d31; + XPoint poly[4]; + + XFillRectangle(dpy, drawable, gcBack, x, y, width, height); + + /* for now, do a centered even-sized square, at least for now */ + size = width; + if (height < width) + size = height; + size &= ~1; + x += (width - size) >> 1; + y += (height - size) >> 1; + + /* + * ----- + * / / + * / / + * / / + * / / + * /____/ + */ + + d11 = (size / 11); + if (d11 < 1) d11 = 1; + d21 = (d11+3) / 4; + d31 = d11 + d11 + d21; + poly[0].x = x + size; poly[0].y = y; + poly[1].x = x + size-d31; poly[1].y = y; + poly[2].x = x + 0; poly[2].y = y + size; + poly[3].x = x + d31; poly[3].y = y + size; + XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin); + + /* + * ------ + * / / + * / __ / + * / / / + * / / / + * /__/__/ + */ + + poly[0].x = x + d31/2; poly[0].y = y + size; + poly[1].x = x + size / 2; poly[1].y = y + size/2; + poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2; + poly[3].x = x + d31; poly[3].y = y + size; + XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin); + + /* + * ------ + * / / / + * /--/ / + * / / + * / / + * /_____/ + */ + + poly[0].x = x + size - d31/2; poly[0].y = y; + poly[1].x = x + size / 2; poly[1].y = y + size/2; + poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2; + poly[3].x = x + size - d31; poly[3].y = y; + XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin); + + /* + * ----- + * \ \ + * \ \ + * \ \ + * \ \ + * \____\ + */ + + poly[0].x = x; poly[0].y = y; + poly[1].x = x + size/4; poly[1].y = y; + poly[2].x = x + size; poly[2].y = y + size; + poly[3].x = x + size - size/4; poly[3].y = y + size; + XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin); + + /* + * / + * / + * / + * / + * / + */ + + poly[0].x = x + size- d11; poly[0].y = y; + poly[1].x = x + size-( d11+d21); poly[1].y = y; + poly[2].x = x + d11; poly[2].y = y + size; + poly[3].x = x + d11 + d21; poly[3].y = y + size; + XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin); + } + + #ifdef XAW_BC + + /* + * For Compatability Only. + */ + + XDrawLogo(dpy, drawable, gcFore, gcBack, x, y, width, height) + Display *dpy; + Drawable drawable; + GC gcFore, gcBack; + int x, y; + unsigned int width, height; + { + XmuDrawLogo(dpy, drawable, gcFore, gcBack, x, y, width, height); + } + + #endif /* XAW_BC */ *** /dev/null Wed Oct 17 15:45:06 1990 --- Lower.c Wed Oct 17 15:45:06 1990 *************** *** 0 --- 1,100 ----- + static char rcsid[] = + "$XConsortium: Lower.c,v 1.3 89/11/11 16:31:07 jim Exp $"; + + /* + * Copyright 1988 by the Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + */ + + #define XK_LATIN1 + #include <X11/keysymdef.h> + + /* + * ISO Latin-1 case conversion routine + */ + + void + XmuCopyISOLatin1Lowered(dst, src) + char *dst, *src; + { + register unsigned char *dest, *source; + + for (dest = (unsigned char *)dst, source = (unsigned char *)src; + *source; + source++, dest++) + { + if ((*source >= XK_A) && (*source <= XK_Z)) + *dest = *source + (XK_a - XK_A); + else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis)) + *dest = *source + (XK_agrave - XK_Agrave); + else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn)) + *dest = *source + (XK_oslash - XK_Ooblique); + else + *dest = *source; + } + *dest = '\0'; + } + + void + XmuCopyISOLatin1Uppered(dst, src) + char *dst, *src; + { + register unsigned char *dest, *source; + + for (dest = (unsigned char *)dst, source = (unsigned char *)src; + *source; + source++, dest++) + { + if ((*source >= XK_a) && (*source <= XK_z)) + *dest = *source - (XK_a - XK_A); + else if ((*source >= XK_agrave) && (*source <= XK_odiaeresis)) + *dest = *source - (XK_agrave - XK_Agrave); + else if ((*source >= XK_slash) && (*source <= XK_thorn)) + *dest = *source - (XK_oslash - XK_Ooblique); + else + *dest = *source; + } + *dest = '\0'; + } + + int XmuCompareISOLatin1 (first, second) + char *first, *second; + { + register unsigned char *ap, *bp; + + for (ap = (unsigned char *) first, bp = (unsigned char *) second; + *ap && *bp; ap++, bp++) { + register unsigned char a, b; + + if ((a = *ap) != (b = *bp)) { + /* try lowercasing and try again */ + + if ((a >= XK_A) && (a <= XK_Z)) + a += (XK_a - XK_A); + else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis)) + a += (XK_agrave - XK_Agrave); + else if ((a >= XK_Ooblique) && (a <= XK_Thorn)) + a += (XK_oslash - XK_Ooblique); + + if ((b >= XK_A) && (b <= XK_Z)) + b += (XK_a - XK_A); + else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis)) + b += (XK_agrave - XK_Agrave); + else if ((b >= XK_Ooblique) && (b <= XK_Thorn)) + b += (XK_oslash - XK_Ooblique); + + if (a != b) break; + } + } + return (((int) *ap) - ((int) *bp)); + } -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62911/62500 ------------------------ "Arms are made for hugging" -------------------------