[comp.sources.d] tvtwm diffs for x11r3

jon@nucleus.mi.org (Jon Block) (09/08/90)

  These patches will allow you to run the recently posted 
tvtwm window manager under release 3 of X. included are a
few files from the release 4 distribution. I am still working
on the final changes for colormaps. the diffs are on the patch
2 level.

----------------------------- cut here ------------------------------
diff -rcN4 tvtwm/CharSet.h tvtwmr3/CharSet.h
*** tvtwm/CharSet.h	Wed Dec 31 19:00:00 1969
--- tvtwmr3/CharSet.h	Fri Sep  7 09:36:30 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_ */
diff -rcN4 tvtwm/DrawLogo.c tvtwmr3/DrawLogo.c
*** tvtwm/DrawLogo.c	Wed Dec 31 19:00:00 1969
--- tvtwmr3/DrawLogo.c	Fri Sep  7 09:36:30 1990
***************
*** 0 ****
--- 1,152 ----
+ #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 */
+ 
+ 
diff -rcN4 tvtwm/Drawing.h tvtwmr3/Drawing.h
*** tvtwm/Drawing.h	Wed Dec 31 19:00:00 1969
--- tvtwmr3/Drawing.h	Fri Sep  7 09:36:40 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_ */
diff -rcN4 tvtwm/Lower.c tvtwmr3/Lower.c
*** tvtwm/Lower.c	Wed Dec 31 19:00:00 1969
--- tvtwmr3/Lower.c	Fri Sep  7 09:36:52 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));
+ }
diff -rcN4 tvtwm/Makefile tvtwmr3/Makefile
*** tvtwm/Makefile	Wed Dec 31 19:00:00 1969
--- tvtwmr3/Makefile	Fri Sep  7 09:37:03 1990
***************
*** 0 ****
--- 1,148 ----
+ #
+ # dme - massaged from the imaked Makefile
+ #
+ # $Id: Makefile,v 2.0 90/07/31 10:58:05 dme Exp Locker: dme $
+ #
+ CC = gcc
+ MV = mv
+ RM = rm -f
+ 
+ # X flags
+ X_CFLAGS = # -DSHAPE -DMULTIBUFFER -DMITSHM -DMITMISC -DXINPUT
+ # 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 ${X_CFLAGS} ${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 -linet
+ 
+ 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
diff -rcN4 tvtwm/add_window.c tvtwmr3/add_window.c
*** tvtwm/add_window.c	Fri Sep  7 09:30:20 1990
--- tvtwmr3/add_window.c	Fri Sep  7 11:46:07 1990
***************
*** 103,113 ****
  	{  0,  1 },			/* SouthGravity */
  	{  1,  1 },			/* SouthEastGravity */
  	{  0,  0 },			/* StaticGravity */
      };
-     register int g = ((tmp->hints.flags & PWinGravity) 
- 		      ? tmp->hints.win_gravity : NorthWestGravity);
  
      if (g < ForgetGravity || g > StaticGravity) {
  	*xp = *yp = 0;
      } else {
  	*xp = gravity_offsets[g].x;
--- 103,113 ----
  	{  0,  1 },			/* SouthGravity */
  	{  1,  1 },			/* SouthEastGravity */
  	{  0,  0 },			/* StaticGravity */
      };
  
+     register int g = tmp->attr.win_gravity;
+ 
      if (g < ForgetGravity || g > StaticGravity) {
  	*xp = *yp = 0;
      } else {
  	*xp = gravity_offsets[g].x;
***************
*** 192,201 ****
  	tmp_win->group = tmp_win->wmhints->window_group;
      else
  	tmp_win->group = NULL;
  
!     if (!XGetWMNormalHints (dpy, tmp_win->w, &tmp_win->hints, &supplied))
!       tmp_win->hints.flags = 0;
  
      /*
       * The July 27, 1988 draft of the ICCCM ignores the size and position
       * fields in the WM_NORMAL_HINTS property.
--- 192,200 ----
  	tmp_win->group = tmp_win->wmhints->window_group;
      else
  	tmp_win->group = NULL;
  
!     XGetNormalHints (dpy, tmp_win->w, &tmp_win->hints);
  
      /*
       * The July 27, 1988 draft of the ICCCM ignores the size and position
       * fields in the WM_NORMAL_HINTS property.
***************
*** 342,350 ****
  	tmp_win->wmhints->initial_state = IconicState;
  	tmp_win->wmhints->flags |= StateHint;
      }
  
-     if (!(supplied & PWinGravity)) SimulateWinGravity (tmp_win);
      GetGravityOffsets (tmp_win, &gravx, &gravy);
  
  
  #ifdef DEBUG
--- 341,348 ----
***************
*** 1292,1300 ****
  {
      unsigned long flags = 0L;
      Atom *protocols = NULL;
      int n;
! 
      if (XGetWMProtocols (dpy, tmp->w, &protocols, &n)) {
  	register int i;
  	register Atom *ap;
  
--- 1290,1298 ----
  {
      unsigned long flags = 0L;
      Atom *protocols = NULL;
      int n;
! /***
      if (XGetWMProtocols (dpy, tmp->w, &protocols, &n)) {
  	register int i;
  	register Atom *ap;
  
***************
*** 1305,1312 ****
--- 1303,1311 ----
  	}
  	if (protocols) XFree ((char *) protocols);
      }
      tmp->protocols = flags;
+ ***/
  }
  
  TwmColormap *
  CreateTwmColormap(c)
***************
*** 1402,1422 ****
  	cwins = tmp->cmaps.cwins;
  	for (i = 0; i < tmp->cmaps.number_cwins; i++)
  	    cwins[i]->colormap->state = 0;
      }
! 
      if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, 
  			       &number_cmap_windows) &&
  	number_cmap_windows > 0) {
  
  	can_free_cmap_windows = False;
! 	/*
  	 * check if the top level is in the list, add to front if not
! 	 */
  	for (i = 0; i < number_cmap_windows; i++) {
  	    if (cmap_windows[i] == tmp->w) break;
  	}
! 	if (i == number_cmap_windows) {	 /* not in list */
  	    Window *new_cmap_windows =
  	      (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1));
  
  	    if (!new_cmap_windows) {
--- 1401,1421 ----
  	cwins = tmp->cmaps.cwins;
  	for (i = 0; i < tmp->cmaps.number_cwins; i++)
  	    cwins[i]->colormap->state = 0;
      }
! /***
      if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, 
  			       &number_cmap_windows) &&
  	number_cmap_windows > 0) {
  
  	can_free_cmap_windows = False;
! 	**
  	 * check if the top level is in the list, add to front if not
! 	 **
  	for (i = 0; i < number_cmap_windows; i++) {
  	    if (cmap_windows[i] == tmp->w) break;
  	}
! 	if (i == number_cmap_windows) {	 ** not in list **
  	    Window *new_cmap_windows =
  	      (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1));
  
  	    if (!new_cmap_windows) {
***************
*** 1424,1437 ****
  			 "%s:  unable to allocate %d element colormap window array\n",
  			ProgramName, number_cmap_windows+1);
  		goto done;
  	    }
! 	    new_cmap_windows[0] = tmp->w;  /* add to front */
! 	    for (i = 0; i < number_cmap_windows; i++) {	 /* append rest */
  		new_cmap_windows[i+1] = cmap_windows[i];
  	    }
  	    XFree ((char *) cmap_windows);
! 	    can_free_cmap_windows = True;  /* do not use XFree any more */
  	    cmap_windows = new_cmap_windows;
  	    number_cmap_windows++;
  	}
  
--- 1423,1436 ----
  			 "%s:  unable to allocate %d element colormap window array\n",
  			ProgramName, number_cmap_windows+1);
  		goto done;
  	    }
! 	    new_cmap_windows[0] = tmp->w;  ** add to front **
! 	    for (i = 0; i < number_cmap_windows; i++) {	 ** append rest **
  		new_cmap_windows[i+1] = cmap_windows[i];
  	    }
  	    XFree ((char *) cmap_windows);
! 	    can_free_cmap_windows = True;  ** do not use XFree any more **
  	    cmap_windows = new_cmap_windows;
  	    number_cmap_windows++;
  	}
  
***************
*** 1439,1449 ****
  		number_cmap_windows);
  	if (cwins) {
  	    for (i = 0; i < number_cmap_windows; i++) {
  
! 		/*
  		 * Copy any existing entries into new list.
! 		 */
  		for (j = 0; j < tmp->cmaps.number_cwins; j++) {
  		    if (tmp->cmaps.cwins[j]->w == cmap_windows[i]) {
  			cwins[i] = tmp->cmaps.cwins[j];
  			cwins[i]->refcnt++;
--- 1438,1448 ----
  		number_cmap_windows);
  	if (cwins) {
  	    for (i = 0; i < number_cmap_windows; i++) {
  
! 		**
  		 * Copy any existing entries into new list.
! 		 **
  		for (j = 0; j < tmp->cmaps.number_cwins; j++) {
  		    if (tmp->cmaps.cwins[j]->w == cmap_windows[i]) {
  			cwins[i] = tmp->cmaps.cwins[j];
  			cwins[i]->refcnt++;
***************
*** 1450,1462 ****
  			break;
  		    }
  		}
  
! 		/*
  		 * If the colormap window is not being pointed by
  		 * some other applications colormap window list,
  		 * create a new entry.
! 		 */
  		if (j == tmp->cmaps.number_cwins) {
  		    if (XFindContext(dpy, cmap_windows[i], ColormapContext,
  				     (caddr_t *)&cwins[i]) == XCNOENT) {
  			if ((cwins[i] = CreateColormapWindow(cmap_windows[i],
--- 1449,1461 ----
  			break;
  		    }
  		}
  
! 		**
  		 * If the colormap window is not being pointed by
  		 * some other applications colormap window list,
  		 * create a new entry.
! 		 **
  		if (j == tmp->cmaps.number_cwins) {
  		    if (XFindContext(dpy, cmap_windows[i], ColormapContext,
  				     (caddr_t *)&cwins[i]) == XCNOENT) {
  			if ((cwins[i] = CreateColormapWindow(cmap_windows[i],
***************
*** 1473,1481 ****
  		}
  	    }
  	}
      }
! 
      /* No else here, in case we bailed out of clause above.
       */
      if (number_cmap_windows == 0) {
  
--- 1472,1480 ----
  		}
  	    }
  	}
      }
! ***/
      /* No else here, in case we bailed out of clause above.
       */
      if (number_cmap_windows == 0) {
  
***************
*** 1521,1532 ****
  	static int gravs[] = { SouthEastGravity, SouthWestGravity,
  			       NorthEastGravity, NorthWestGravity };
  	int right =  tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw;
  	int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw;
! 	tmp->hints.win_gravity = 
  	  gravs[((Scr->MyDisplayHeight - bottom < tmp->title_height) ? 0 : 2) |
  		((Scr->MyDisplayWidth - right   < tmp->title_height) ? 0 : 1)];
- 	tmp->hints.flags |= PWinGravity;
      }
  }
  
  static void
--- 1520,1530 ----
  	static int gravs[] = { SouthEastGravity, SouthWestGravity,
  			       NorthEastGravity, NorthWestGravity };
  	int right =  tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw;
  	int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw;
! 	tmp->attr.win_gravity = 
  	  gravs[((Scr->MyDisplayHeight - bottom < tmp->title_height) ? 0 : 2) |
  		((Scr->MyDisplayWidth - right   < tmp->title_height) ? 0 : 1)];
      }
  }
  
  static void
diff -rcN4 tvtwm/events.c tvtwmr3/events.c
*** tvtwm/events.c	Fri Sep  7 09:30:22 1990
--- tvtwmr3/events.c	Fri Sep  7 10:55:39 1990
***************
*** 674,701 ****
      XSetWindowAttributes attributes;	/* attributes for create windows */
      Pixmap pm;
      long supplied;
  
-     /* watch for standard colormap changes */
-     if (Event.xproperty.window == Scr->Root) {
- 	XStandardColormap *maps = NULL;
- 	int nmaps;
- 
- 	switch (Event.xproperty.state) {
- 	  case PropertyNewValue:
- 	    if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, 
- 				  Event.xproperty.atom)) {
- 		/* if got one, then replace any existing entry */
- 		InsertRGBColormap (Event.xproperty.atom, maps, nmaps, True);
- 	    }
- 	    return;
- 
- 	  case PropertyDelete:
- 	    RemoveRGBColormap (Event.xproperty.atom);
- 	    return;
- 	}
-     }
- 
      if (!Tmp_win) return;		/* unknown window */
  
  #define MAX_NAME_LEN 200L		/* truncate to this many */
  #define MAX_ICON_NAME_LEN 200L		/* ditto */
--- 674,681 ----
***************
*** 849,859 ****
  	}
  	break;
  
        case XA_WM_NORMAL_HINTS:
! 	if (XGetWMNormalHints (dpy, Tmp_win->w, &Tmp_win->hints, &supplied) &&
! 	    !(supplied & PWinGravity))
! 	  SimulateWinGravity (Tmp_win);
  	break;
  
        default:
  	if (Event.xproperty.atom == _XA_WM_COLORMAP_WINDOWS) {
--- 829,838 ----
  	}
  	break;
  
        case XA_WM_NORMAL_HINTS:
! 	XGetNormalHints (dpy, Tmp_win->w, &Tmp_win->hints);
! 	SimulateWinGravity (Tmp_win);
  	break;
  
        default:
  	if (Event.xproperty.atom == _XA_WM_COLORMAP_WINDOWS) {
diff -rcN4 tvtwm/gram.y tvtwmr3/gram.y
*** tvtwm/gram.y	Wed Sep  5 10:21:21 1990
--- tvtwmr3/gram.y	Fri Sep  7 09:38:00 1990
***************
*** 45,53 ****
  #include "util.h"
  #include "screen.h"
  #include "parse.h"
  #include <X11/Xos.h>
! #include <X11/Xmu/CharSet.h>
  
  static char *Action = "";
  static char *Name = "";
  static MenuRoot	*root, *pull = NULL;
--- 45,53 ----
  #include "util.h"
  #include "screen.h"
  #include "parse.h"
  #include <X11/Xos.h>
! #include "CharSet.h"
  
  static char *Action = "";
  static char *Name = "";
  static MenuRoot	*root, *pull = NULL;
diff -rcN4 tvtwm/iconmgr.c tvtwmr3/iconmgr.c
*** tvtwm/iconmgr.c	Wed Sep  5 10:21:22 1990
--- tvtwmr3/iconmgr.c	Fri Sep  7 09:55:25 1990
***************
*** 38,46 ****
  #include "add_window.h"
  #include "siconify.bm"
  #include "vdt.h"
  #include <X11/Xos.h>
! #include <X11/Xmu/CharSet.h>
  
  int strcmp();
  
  int iconmgr_textx = siconify_width+11;
--- 38,46 ----
  #include "add_window.h"
  #include "siconify.bm"
  #include "vdt.h"
  #include <X11/Xos.h>
! #include "CharSet.h"
  
  int strcmp();
  
  int iconmgr_textx = siconify_width+11;
diff -rcN4 tvtwm/menus.c tvtwmr3/menus.c
*** tvtwm/menus.c	Fri Sep  7 09:30:24 1990
--- tvtwmr3/menus.c	Fri Sep  7 09:46:43 1990
***************
*** 52,60 ****
  #include "util.h"
  #include "parse.h"
  #include "gram.h"
  #include "screen.h"
! #include <X11/bitmaps/menu12>
  #include "version.h"
  #include "vdt.h"
  #include "add_window.h"
  #include "patchlevel.h"
--- 52,60 ----
  #include "util.h"
  #include "parse.h"
  #include "gram.h"
  #include "screen.h"
! #include <X11/bitmaps/stipple>
  #include "version.h"
  #include "vdt.h"
  #include "add_window.h"
  #include "patchlevel.h"
***************
*** 398,411 ****
  	    /* create the pull right pixmap if needed */
  	    if (Scr->pullPm == None)
  	    {
  		Scr->pullPm = XCreatePixmapFromBitmapData(dpy, Scr->Root,
! 		    menu12_bits, menu12_width, menu12_height, 1, 0, 1);
  	    }
! 	    x = mr->width - menu12_width - 5;
! 	    y = y_offset + ((Scr->MenuFont.height - menu12_height) / 2);
  	    XCopyPlane(dpy, Scr->pullPm, mr->w, gc, 0, 0,
! 		menu12_width, menu12_height, x, y, 1);
  	}
      }
      else
      {
--- 398,411 ----
  	    /* create the pull right pixmap if needed */
  	    if (Scr->pullPm == None)
  	    {
  		Scr->pullPm = XCreatePixmapFromBitmapData(dpy, Scr->Root,
! 		    stipple_bits, stipple_width, stipple_height, 1, 0, 1);
  	    }
! 	    x = mr->width - stipple_width - 5;
! 	    y = y_offset + ((Scr->MenuFont.height - stipple_height) / 2);
  	    XCopyPlane(dpy, Scr->pullPm, mr->w, gc, 0, 0,
! 		stipple_width, stipple_height, x, y, 1);
  	}
      }
      else
      {
diff -rcN4 tvtwm/parse.c tvtwmr3/parse.c
*** tvtwm/parse.c	Fri Sep  7 09:30:25 1990
--- tvtwmr3/parse.c	Fri Sep  7 09:44:39 1990
***************
*** 42,50 ****
  #endif
  
  #include <stdio.h>
  #include <X11/Xos.h>
! #include <X11/Xmu/CharSet.h>
  #include "twm.h"
  #include "screen.h"
  #include "menus.h"
  #include "util.h"
--- 42,50 ----
  #endif
  
  #include <stdio.h>
  #include <X11/Xos.h>
! #include "CharSet.h"
  #include "twm.h"
  #include "screen.h"
  #include "menus.h"
  #include "util.h"
diff -rcN4 tvtwm/resize.c tvtwmr3/resize.c
*** tvtwm/resize.c	Fri Sep  7 09:30:28 1990
--- tvtwmr3/resize.c	Fri Sep  7 09:53:20 1990
***************
*** 405,417 ****
      /*
       * ICCCM says that PMinSize is the default is no PBaseSize is given,
       * and vice-versa.
       */
!     if (tmp_win->hints.flags&(PMinSize|PBaseSize) && tmp_win->hints.flags & PResizeInc)
      {
! 	if (tmp_win->hints.flags & PBaseSize) {
! 	    dwidth -= tmp_win->hints.base_width;
! 	    dheight -= tmp_win->hints.base_height;
  	} else {
  	    dwidth -= tmp_win->hints.min_width;
  	    dheight -= tmp_win->hints.min_height;
  	}
--- 405,417 ----
      /*
       * ICCCM says that PMinSize is the default is no PBaseSize is given,
       * and vice-versa.
       */
!     if (tmp_win->hints.flags&(PMinSize|PSize) && tmp_win->hints.flags & PResizeInc)
      {
! 	if (tmp_win->hints.flags & PSize) {
! 	    dwidth -= tmp_win->hints.width;
! 	    dheight -= tmp_win->hints.height;
  	} else {
  	    dwidth -= tmp_win->hints.min_width;
  	    dheight -= tmp_win->hints.min_height;
  	}
***************
*** 537,553 ****
  
      if (tmp_win->hints.flags & PMinSize) {
          minWidth = tmp_win->hints.min_width;
          minHeight = tmp_win->hints.min_height;
!     } else if (tmp_win->hints.flags & PBaseSize) {
!         minWidth = tmp_win->hints.base_width;
!         minHeight = tmp_win->hints.base_height;
      } else
          minWidth = minHeight = 1;
  
!     if (tmp_win->hints.flags & PBaseSize) {
! 	baseWidth = tmp_win->hints.base_width;
! 	baseHeight = tmp_win->hints.base_height;
      } else if (tmp_win->hints.flags & PMinSize) {
  	baseWidth = tmp_win->hints.min_width;
  	baseHeight = tmp_win->hints.min_height;
      } else
--- 537,553 ----
  
      if (tmp_win->hints.flags & PMinSize) {
          minWidth = tmp_win->hints.min_width;
          minHeight = tmp_win->hints.min_height;
!     } else if (tmp_win->hints.flags & PSize) {
!         minWidth = tmp_win->hints.width;
!         minHeight = tmp_win->hints.height;
      } else
          minWidth = minHeight = 1;
  
!     if (tmp_win->hints.flags & PSize) {
! 	baseWidth = tmp_win->hints.width;
! 	baseHeight = tmp_win->hints.height;
      } else if (tmp_win->hints.flags & PMinSize) {
  	baseWidth = tmp_win->hints.min_width;
  	baseHeight = tmp_win->hints.min_height;
      } else
diff -rcN4 tvtwm/twm.h tvtwmr3/twm.h
*** tvtwm/twm.h	Fri Sep  7 09:30:31 1990
--- tvtwmr3/twm.h	Fri Sep  7 11:36:01 1990
***************
*** 62,69 ****
--- 62,71 ----
  
  #define BW 2			/* border width */
  #define BW2 4			/* border width  * 2 */
  
+ #define BITMAPS "/usr/include/X11/bitmaps"
+ 
  #ifndef TRUE
  #define TRUE	1
  #define FALSE	0
  #endif
diff -rcN4 tvtwm/util.c tvtwmr3/util.c
*** tvtwm/util.c	Wed Sep  5 10:21:39 1990
--- tvtwmr3/util.c	Fri Sep  7 12:05:06 1990
***************
*** 47,56 ****
  #include "gram.h"
  #include "screen.h"
  #include <X11/Xos.h>
  #include <X11/Xatom.h>
! #include <X11/Xmu/Drawing.h>
! #include <X11/Xmu/CharSet.h>
  
  static Pixmap CreateXLogoPixmap(), CreateResizePixmap();
  static Pixmap CreateQuestionPixmap(), CreateMenuPixmap();
  int HotX, HotY;
--- 47,56 ----
  #include "gram.h"
  #include "screen.h"
  #include <X11/Xos.h>
  #include <X11/Xatom.h>
! #include "Drawing.h"
! #include "CharSet.h"
  
  static Pixmap CreateXLogoPixmap(), CreateResizePixmap();
  static Pixmap CreateQuestionPixmap(), CreateMenuPixmap();
  int HotX, HotY;
***************
*** 318,325 ****
--- 318,326 ----
      unsigned int *widthp, *heightp;
  {
      char *bigname;
      Pixmap pm;
+ 	int status;
  
      if (!name) return None;
  
      /*
***************
*** 353,391 ****
       * Generate a full pathname if any special prefix characters (such as ~)
       * are used.  If the bigname is different from name, bigname will need to
       * be freed.
       */
!     bigname = ExpandFilename (name);
      if (!bigname) return None;
  
!     /*
!      * look along bitmapFilePath resource same as toolkit clients
!      */
!     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)
! 	 */
! 	bigname = (char *) malloc (strlen(name) + strlen(Scr->IconDirectory) +
! 				   2);
! 	if (!bigname) {
  	    fprintf (stderr,
! 		     "%s:  unable to allocate memory for \"%s/%s\"\n",
! 		     ProgramName, Scr->IconDirectory, name);
  	    return None;
! 	}
! 	(void) sprintf (bigname, "%s/%s", Scr->IconDirectory, name);
! 	if (XReadBitmapFile (dpy, Scr->Root, bigname, widthp, heightp, &pm,
! 			     &HotX, &HotY) != BitmapSuccess) {
  	    pm = None;
! 	}
      }
      if (bigname != name) free (bigname);
      if (pm == None) {
! 	fprintf (stderr, "%s:  unable to find bitmap \"%s\"\n", 
! 		 ProgramName, name);
      }
  
      return pm;
  }
--- 354,403 ----
       * Generate a full pathname if any special prefix characters (such as ~)
       * are used.  If the bigname is different from name, bigname will need to
       * be freed.
       */
! 	name = ExpandFilename(name);
! 	bigname = name;
      if (!bigname) return None;
  
! 	status = XReadBitmapFile( dpy, Scr->Root, bigname, widthp, heightp, &pm,
! 							 &HotX, &HotY );
! 
!     if (status != BitmapSuccess && Scr->IconDirectory && name[0] != '/') {
! 	  if (bigname != name) free (bigname);
! 	  bigname = (char *) malloc (strlen(name) + strlen(Scr->IconDirectory) +
! 								 2);
! 	  if (!bigname) {
  	    fprintf (stderr,
! 				 "%s:  unable to allocate memory for \"%s/%s\"\n",
! 				 ProgramName, Scr->IconDirectory, name);
  	    return None;
! 	  }
! 	  (void) sprintf (bigname, "%s/%s", Scr->IconDirectory, name);
! 	  if (XReadBitmapFile (dpy, Scr->Root, bigname, widthp, heightp, &pm,
! 						   &HotX, &HotY) != BitmapSuccess) {
  	    pm = None;
! 	  }
!     }
!     if (status != BitmapSuccess && name[0] != '/') {
! 	  if (bigname != name) free (bigname);
! 	  bigname = (char *) malloc (strlen(name) + strlen(BITMAPS) + 2);
! 	  if (!bigname) {
! 	    fprintf (stderr,
! 				 "%s:  unable to allocate memory for \"%s/%s\"\n",
! 				 ProgramName, Scr->IconDirectory, name);
! 	    return None;
! 	  }
! 	  (void) sprintf (bigname, "%s/%s", BITMAPS, name);
! 	  if (XReadBitmapFile (dpy, Scr->Root, bigname, widthp, heightp, &pm,
! 						   &HotX, &HotY) != BitmapSuccess) {
! 	    pm = None;
! 	  }
      }
      if (bigname != name) free (bigname);
      if (pm == None) {
! 	  fprintf (stderr, "%s:  unable to find bitmap \"%s\"\n", 
! 			   ProgramName, name);
      }
  
      return pm;
  }
***************
*** 463,482 ****
  {
      Atom *atoms;
      int natoms;
      int i;
! 
      atoms = XListProperties (dpy, Scr->Root, &natoms);
      for (i = 0; i < natoms; i++) {
  	XStandardColormap *maps = NULL;
  	int nmaps;
  
  	if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, atoms[i])) {
! 	    /* if got one, then append to current list */
  	    InsertRGBColormap (atoms[i], maps, nmaps, False);
  	}
      }
      if (atoms) XFree ((char *) atoms);
      return;
  }
  
  GetColor(kind, what, name)
--- 475,495 ----
  {
      Atom *atoms;
      int natoms;
      int i;
! /*****
      atoms = XListProperties (dpy, Scr->Root, &natoms);
      for (i = 0; i < natoms; i++) {
  	XStandardColormap *maps = NULL;
  	int nmaps;
  
  	if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, atoms[i])) {
! 	    ** if got one, then append to current list **
  	    InsertRGBColormap (atoms[i], maps, nmaps, False);
  	}
      }
      if (atoms) XFree ((char *) atoms);
+ *****/
      return;
  }
  
  GetColor(kind, what, name)
diff -rcN4 tvtwm/vdt.c tvtwmr3/vdt.c
*** tvtwm/vdt.c	Fri Sep  7 09:30:32 1990
--- tvtwmr3/vdt.c	Fri Sep  7 10:08:40 1990
***************
*** 506,515 ****
  
  void
  MakePanner()
  {
!     static XTextProperty wName={(unsigned char *) "Virtual Desktop",XA_STRING,8,15};
!     static XTextProperty iName={(unsigned char *) "Desktop",XA_STRING,8,7};
      XSetWindowAttributes attr;
      XSizeHints *sizeHints;
      XWMHints *wmHints;
      XClassHint *classHints;
--- 506,516 ----
  
  void
  MakePanner()
  {
!     static char *wName="Virtual Desktop";
!     static char *iName="Desktop";
! 	int ux, uy, uwidth, uheight, rmask;
      XSetWindowAttributes attr;
      XSizeHints *sizeHints;
      XWMHints *wmHints;
      XClassHint *classHints;
***************
*** 521,545 ****
  
      width = Scr->vdtWidth/Scr->PannerScale;
      height = Scr->vdtHeight/Scr->PannerScale;
  
!     sizeHints = XAllocSizeHints();
!     sizeHints->flags = PBaseSize;
!     sizeHints->base_width = width;
!     sizeHints->base_height = height;
      sizeHints->min_width = Scr->MyDisplayWidth/Scr->PannerScale;
      sizeHints->min_height = Scr->MyDisplayHeight/Scr->PannerScale;
      sizeHints->max_width = MAX_VDT_WIDTH/Scr->PannerScale;
      sizeHints->max_height = MAX_VDT_HEIGHT/Scr->PannerScale;
!     XWMGeometry(dpy, Scr->screen, Scr->PannerGeometry, NULL,
! 	1, sizeHints, &x, &y, &width, &height, &sizeHints->win_gravity);
!     sizeHints->flags = USPosition|PWinGravity|PMinSize|PMaxSize;
  
!     wmHints = XAllocWMHints();
      wmHints->initial_state = Scr->PannerState;
      wmHints->flags = StateHint;
  
!     classHints = XAllocClassHint();
      classHints->res_name = "virtualDesktop";
      classHints->res_class = "Twm";
  
      bm = None;
--- 522,546 ----
  
      width = Scr->vdtWidth/Scr->PannerScale;
      height = Scr->vdtHeight/Scr->PannerScale;
  
!     sizeHints = (XSizeHints *)malloc(sizeof(XSizeHints));
!     sizeHints->flags = PSize;
!     sizeHints->width = width;
!     sizeHints->height = height;
      sizeHints->min_width = Scr->MyDisplayWidth/Scr->PannerScale;
      sizeHints->min_height = Scr->MyDisplayHeight/Scr->PannerScale;
      sizeHints->max_width = MAX_VDT_WIDTH/Scr->PannerScale;
      sizeHints->max_height = MAX_VDT_HEIGHT/Scr->PannerScale;
!     XGeometry(dpy, Scr->screen, Scr->PannerGeometry, NULL,
! 	1, 1, 1, 0, 0, &x, &y, &width, &height);
!     sizeHints->flags = USPosition|PMinSize|PMaxSize;
  
!     wmHints = (XWMHints *)malloc(sizeof(XWMHints));
      wmHints->initial_state = Scr->PannerState;
      wmHints->flags = StateHint;
  
!     classHints = (XClassHint *)malloc(sizeof(XClassHint));
      classHints->res_name = "virtualDesktop";
      classHints->res_class = "Twm";
  
      bm = None;
***************
*** 568,591 ****
  	attrMask &= ~CWBackPixmap;
  	attrMask |= CWBackPixel;
  	attr.background_pixel = Scr->PannerC.back;
      }
      Scr->Panner = XCreateWindow(dpy, Scr->Root, x, y, 
! 	    sizeHints->base_width, sizeHints->base_height, 1,
  	    Scr->d_depth, CopyFromParent,
  	    Scr->d_visual, attrMask, &attr);
      
!     Scr->PannerWidth = sizeHints->base_width;
!     Scr->PannerHeight = sizeHints->base_height;
  
      XGrabButton(dpy, Button1, AnyModifier, Scr->Panner,
  	True, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
  	GrabModeAsync, GrabModeAsync, Scr->Panner, None);
      XGrabButton(dpy, Button3, AnyModifier, Scr->Panner,
  	True, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
  	GrabModeAsync, GrabModeAsync, Scr->Panner, None);
!     XSetWMProperties(dpy, Scr->Panner, &wName, &iName, NULL, 0,
! 	sizeHints, wmHints, classHints);
  
      if (Scr->PannerState != WithdrawnState)
  	XMapRaised(dpy, Scr->Panner);
      XSaveContext(dpy, Scr->Panner, ScreenContext, (caddr_t) Scr);
--- 569,616 ----
  	attrMask &= ~CWBackPixmap;
  	attrMask |= CWBackPixel;
  	attr.background_pixel = Scr->PannerC.back;
      }
+ 	attrMask |= CWWinGravity;
+ 	rmask = XParseGeometry(Scr->PannerGeometry, &ux, &uy, &uwidth, &uheight);
+     switch (rmask & (XNegative|YNegative)) {
+       case 0:
+         attr.win_gravity = NorthWestGravity;
+         break;
+       case XNegative:
+ 		x -= sizeHints->width;
+         attr.win_gravity = NorthEastGravity;
+         break;
+       case YNegative:
+ 		y -= sizeHints->height;
+         attr.win_gravity = SouthWestGravity;
+         break;
+       default:
+ 		x -= sizeHints->width;
+ 		y -= sizeHints->height;
+         attr.win_gravity = SouthEastGravity;
+         break;
+     }
      Scr->Panner = XCreateWindow(dpy, Scr->Root, x, y, 
! 	    sizeHints->width, sizeHints->height, 1,
  	    Scr->d_depth, CopyFromParent,
  	    Scr->d_visual, attrMask, &attr);
      
!     Scr->PannerWidth = sizeHints->width;
!     Scr->PannerHeight = sizeHints->height;
  
      XGrabButton(dpy, Button1, AnyModifier, Scr->Panner,
  	True, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
  	GrabModeAsync, GrabModeAsync, Scr->Panner, None);
      XGrabButton(dpy, Button3, AnyModifier, Scr->Panner,
  	True, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
  	GrabModeAsync, GrabModeAsync, Scr->Panner, None);
! 
! 	XStoreName(dpy, Scr->Panner, wName);
! 	XSetIconName(dpy, Scr->Panner, iName);
! 	XSetNormalHints(dpy, Scr->Panner, sizeHints);
! 	XSetWMHints(dpy, Scr->Panner, wmHints);
! 	XSetClassHint(dpy, Scr->Panner, classHints);
  
      if (Scr->PannerState != WithdrawnState)
  	XMapRaised(dpy, Scr->Panner);
      XSaveContext(dpy, Scr->Panner, ScreenContext, (caddr_t) Scr);