[comp.windows.x] Updates to twm, part 1 of 2

tlastran@esunix.UUCP (Tom LaStrange) (04/29/88)

Here are updates/bug fixes to twm.  These patches bring twm from 
Revision 2.0 to Revision 2.7.  PLEASE read the README file, in
particular, take note that f.focus has been changed to f.unfocus, and
f.focus does something different.

If by chance, you are getting these patches but did not receive Revision 2.0,
let me know and I can send out the current sources for Revision 2.7.

Thanks for your input,

Tom LaStrange
Evans & Sutherland Computer Corporation

UUCP Address:  {ihnp4,seismo}!utah-cs!utah-gr!uplherc!esunix!tlastran
Alternate:     {ihnp4,decvax}!decwrl!esunix!tlastran

-------------------------------- cut --------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1.  Remove everything above the #! /bin/sh line.
# 2.  Save the resulting test in a file
# 3.  Execute the file with /bin/sh (not csh) to create the files:
#
#README
#gray.bm
#twm.patches1
#
# Created by tlastran (Tom LaStrange) on Fri Apr 29 07:35:12 MDT 1988
#
if test -f 'README'
then
    echo shar: will not over-write existing file "README"
else
echo extracting "README"
sed 's/^X//' >README <<'SHAR_EOF'
XApril 29, 1988
X
XThank you for all the helpful suggestions and bug reports.
X
XThe following new features / bug fixes have taken place since Revision 2.0.
X
X1.  PLEASE NOTE THAT THE ROOT FUNCTION f.focus HAS BEEN CHANGED TO
X    f.unfocus.
X
X2.  Menu entries with empty strings no longer crash twm.
X
X3.  Buttons tied to non-existent menus no longer crash twm.
X
X4.  There were bugs in the f.file and f.cutfile functions relating
X    to the length of the string placed in the cut buffer.  These have
X    been fixed.
X
X4.  I have added the following root functions which are selectable from
X    menus:
X
X      f.move
X      f.iconify
X      f.focus
X      f.resize
X      f.raise
X      f.lower
X      f.destroy
X
X    This allows titlebarless windows to be moved, resized, etc.  This
X    was the #1 requested feature.
X
X6.  The #2 requested feature, initial window positioning ala uwm.  I chose
X    not to implement the button 3 function of trying to make the window
X    extend to the bottom of the display.
X
X7.  There is no BorderColor option but the borders of the windows
X    are now gray until the window gets input focus, like xterm.
X
X8.  If you don't like the focus button in the titlebar, you can get rid
X    of it by defining -DNOFOCUS for CFLAGS in the Makefile.
X
XStuff I didn't get to but would like to implement.  I've got to get back
Xto my regular tasks.
X
X1.  I am still not handling PropertyNotify events. 
X
X2.  A BorderColor variable, for that matter handle color.
X
X3.  Tie root functions and strings to function keys.
X
XI did not hear about twm being run on any System V boxes, anyone out
Xthere doing that?
X
X--
XTom LaStrange
X"if you don't like it, don't use it"
X
XEvans & Sutherland Computer Corporation
X
XUUCP Address:  {ihnp4,seismo}!utah-cs!utah-gr!uplherc!esunix!tlastran
XAlternate:     {ihnp4,decvax}!decwrl!esunix!tlastran
SHAR_EOF
if test 1822 -ne "`wc -c < README`"
then
    echo shar: error transmitting "README" '(should have been 1822 characters)'
fi
fi
if test -f 'gray.bm'
then
    echo shar: will not over-write existing file "gray.bm"
else
echo extracting "gray.bm"
sed 's/^X//' >gray.bm <<'SHAR_EOF'
X/* @(#)gray.ic	X10/6.6	11/3/86 */
X#define gray_width 16
X#define gray_height 16
Xstatic char gray_bits[] = {
X   0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X   0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X   0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X   0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa};
SHAR_EOF
if test 312 -ne "`wc -c < gray.bm`"
then
    echo shar: error transmitting "gray.bm" '(should have been 312 characters)'
fi
fi
if test -f 'twm.patches1'
then
    echo shar: will not over-write existing file "twm.patches1"
else
echo extracting "twm.patches1"
sed 's/^X//' >twm.patches1 <<'SHAR_EOF'
X*** Makefile	Fri Apr 29 07:23:38 1988
X--- ../Makefile	Fri Apr 29 06:40:29 1988
X***************
X*** 19,24 ****
X--- 19,27 ----
X  #LIBS= -lX11 -lXrm
X  LIBS= -lX11
X  
X+ #
X+ # -DNOFOCUS  causes the focus button in the title bar to be compiled out 
X+ #
X  CFLAGS= -O
X  LDFLAGS=
X  
X***************
X*** 56,61 ****
X--- 59,65 ----
X  	twm.h \
X  	util.h \
X  	resize.h \
X+ 	add_window.h \
X  	resize.bm \
X  	focus.bm
X  events.o: \
X***************
X*** 87,93 ****
X  	menus.h \
X  	events.h \
X  	util.h \
X! 	twm.bm
X  list.o: \
X  	twm.h \
X  	gram.h
X--- 91,98 ----
X  	menus.h \
X  	events.h \
X  	util.h \
X! 	twm.bm \
X! 	gray.bm
X  list.o: \
X  	twm.h \
X  	gram.h
X***************
X*** 99,104 ****
X--- 104,110 ----
X  	resize.h \
X  	gram.h \
X  	list.h \
X+ 	events.h \
X  	iconify.bm \
X  	resize.bm \
X  	xterm.bm \
X*** gc.c	Fri Apr 29 07:23:43 1988
X--- ../gc.c	Thu Apr 28 07:16:43 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: gc.c,v 1.3 88/04/15 07:09:38 tlastran Exp $
X   *
X   * Open the fonts and create the GCs
X   *
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: gc.c,v 1.5 88/04/28 07:15:08 tlastran Exp $
X   *
X   * Open the fonts and create the GCs
X   *
X***************
X*** 35,41 ****
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: gc.c,v 1.3 88/04/15 07:09:38 tlastran Exp $";
X  #endif lint
X  
X  #include <stdio.h>
X--- 35,41 ----
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: gc.c,v 1.5 88/04/28 07:15:08 tlastran Exp $";
X  #endif lint
X  
X  #include <stdio.h>
X***************
X*** 89,94 ****
X--- 89,97 ----
X      SizeFont = XLoadQueryFont(dpy, SizeFontName);
X      SizeFontHeight = SizeFont->ascent + SizeFont->descent;
X  
X+     InitialFont = XLoadQueryFont(dpy, InitialFontName);
X+     InitialFontHeight = InitialFont->ascent + InitialFont->descent;
X+ 
X      /* create GC's */
X  
X      if (ReverseVideo)
X***************
X*** 165,168 ****
X--- 168,179 ----
X      gcm |= GCBackground;    gcv.background = Background;
X  
X      SizeNormalGC = XCreateGC(dpy, Root, gcm, &gcv);
X+ 
X+     gcm = 0;
X+     gcm |= GCFont;	    gcv.font = InitialFont->fid;
X+     gcm |= GCPlaneMask;	    gcv.plane_mask = mask;
X+     gcm |= GCForeground;    gcv.foreground = Foreground;
X+     gcm |= GCBackground;    gcv.background = Background;
X+ 
X+     InitialNormalGC = XCreateGC(dpy, Root, gcm, &gcv);
X  }
X*** list.c	Fri Apr 29 07:23:44 1988
X--- ../list.c	Tue Apr 26 08:04:50 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: list.c,v 1.2 88/04/15 07:09:53 tlastran Exp $
X   *
X   * TWM code to deal with the name lists for the NoTitle list and
X   * the AutoRaise list
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: list.c,v 1.3 88/04/26 08:03:05 tlastran Exp $
X   *
X   * TWM code to deal with the name lists for the NoTitle list and
X   * the AutoRaise list
X***************
X*** 36,42 ****
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: list.c,v 1.2 88/04/15 07:09:53 tlastran Exp $";
X  #endif lint
X  
X  #include <stdio.h>
X--- 36,42 ----
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: list.c,v 1.3 88/04/26 08:03:05 tlastran Exp $";
X  #endif lint
X  
X  #include <stdio.h>
X***************
X*** 99,105 ****
X  /***********************************************************************
X   *
X   *  Procedure:
X!  *	LookInList - look through a list for a window name
X   *
X   *  Returned Value:
X   *	TRUE	- the window was found in the list
X--- 99,105 ----
X  /***********************************************************************
X   *
X   *  Procedure:
X!  *	LookInList - look through a list for a window name, or class
X   *
X   *  Returned Value:
X   *	TRUE	- the window was found in the list
X***************
X*** 108,121 ****
X   *  Inputs:
X   *	list	- a #define to identify the list
X   *	name	- a pointer to the name to look for
X   *
X   ***********************************************************************
X   */
X  
X  int
X! LookInList(list, name)
X  int list;
X  char *name;
X  {
X      name_list *l;
X      name_list *ptr;
X--- 108,123 ----
X   *  Inputs:
X   *	list	- a #define to identify the list
X   *	name	- a pointer to the name to look for
X+  *	class	- a pointer to the class to look for
X   *
X   ***********************************************************************
X   */
X  
X  int
X! LookInList(list, name, class)
X  int list;
X  char *name;
X+ XClassHint *class;
X  {
X      name_list *l;
X      name_list *ptr;
X***************
X*** 136,142 ****
X  	int len;
X  
X  	len = strlen(ptr->name);
X! 	if (strncmp(name, ptr->name, len) == 0)
X  	    return (TRUE);
X      }
X      return (FALSE);
X--- 138,146 ----
X  	int len;
X  
X  	len = strlen(ptr->name);
X! 	if (strncmp(class->res_name, ptr->name, len) == 0 ||
X! 	 strncmp(class->res_class, ptr->name, len) == 0 ||
X! 	 strncmp(name, ptr->name, len) == 0)
X  	    return (TRUE);
X      }
X      return (FALSE);
XNo differences encountered
X*** util.c	Fri Apr 29 07:23:50 1988
X--- ../util.c	Thu Apr 28 06:30:50 1988
X***************
X*** 25,31 ****
X  
X  /***********************************************************************
X   *
X!  * $Header: util.c,v 1.10 88/04/15 07:09:43 tlastran Exp $
X   *
X   * utility routines for twm
X   *
X--- 25,31 ----
X  
X  /***********************************************************************
X   *
X!  * $Header: util.c,v 1.11 88/04/26 08:02:58 tlastran Exp $
X   *
X   * utility routines for twm
X   *
X***************
X*** 35,41 ****
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: util.c,v 1.10 88/04/15 07:09:43 tlastran Exp $";
X  #endif
X  
X  #include <stdio.h>
X--- 35,41 ----
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: util.c,v 1.11 88/04/26 08:02:58 tlastran Exp $";
X  #endif
X  
X  #include <stdio.h>
X***************
X*** 287,289 ****
X--- 287,290 ----
X      if (status != BitmapSuccess)
X  	UnknownPm = NULL;
X  }
X+ 
X*** Sample.twmrc	Fri Apr 29 07:23:39 1988
X--- ../Sample.twmrc	Fri Apr 29 06:44:07 1988
X***************
X*** 39,57 ****
X  menu "button1"
X  {
X  "Other Logins"	f.title
X! "iguana 24"	!"xterm -T xterm_iguana_24 =80x24+100+100 -e rlogin iguana &"
X! "iguana 48"	!"xterm -T xterm_iguana_48 =80x48+50+50 -e rlogin iguana &"
X! "worm 24"	!"xterm -T xterm_worm_24 =80x24+100+100 &"
X! "worm 48"	!"xterm -T xterm_worm_48 =80x48+50+50 &"
X! "shiva"		!"xterm -T xterm_shiva =80x24+200+200 -e rlogin shiva &"
X! "tegus"		!"xterm -T xterm_tegus =80x24+200+200 -e rlogin tegus &"
X! "shade"		!"xterm -T xterm_shade =80x24+200+200 -e rlogin shade &"
X! "bilbo"		!"xterm -T xterm_bilbo =80x24+250+250 -e rlogin bilbo &"
X! "frodo"		!"xterm -T xterm_frodo =80x24+300+300 -e rlogin frodo &"
X! "esunix"	!"xterm -T xterm_esunix =80x24+350+350 -e rlogin esunix &"
X! "lynx8"		!"xterm -T xterm_lynx8 =80x24+370+370 -e rlogin lynx8 &"
X! "lynx13"	!"xterm -T xterm_lynx13 =80x24+390+390 -e rlogin lynx13 &"
X! "zephyr"	!"xterm -T xterm_zephyr =80x24+390+390 -e rlogin zephyr &"
X  }
X  
X  menu "button2"
X--- 39,57 ----
X  menu "button1"
X  {
X  "Other Logins"	f.title
X! "iguana 24"	!"xterm -T iguana_24 =80x24+100+100 -e rlogin iguana &"
X! "iguana 48"	!"xterm -T iguana_48 =80x48+50+50 -e rlogin iguana &"
X! "worm 24"	!"xterm -T worm_24 =80x24+100+100 &"
X! "worm 48"	!"xterm -T worm_48 =80x48+50+50 &"
X! "shiva"		!"xterm -T shiva =80x24+200+200 -e rlogin shiva &"
X! "tegus"		!"xterm -T tegus =80x24+200+200 -e rlogin tegus &"
X! "shade"		!"xterm -T shade =80x24+200+200 -e rlogin shade &"
X! "bilbo"		!"xterm -T bilbo =80x24+250+250 -e rlogin bilbo &"
X! "frodo"		!"xterm -T frodo =80x24+300+300 -e rlogin frodo &"
X! "esunix"	!"xterm -T esunix =80x24+350+350 -e rlogin esunix &"
X! "lynx8"		!"xterm -T lynx8 =80x24+370+370 -e rlogin lynx8 &"
X! "lynx13"	!"xterm -T lynx13 =80x24+390+390 -e rlogin lynx13 &"
X! "zephyr"	!"xterm -T zephyr =80x24+390+390 -e rlogin zephyr &"
X  }
X  
X  menu "button2"
X***************
X*** 58,68 ****
X  {
X  "Window Ops"		f.title
X  "Refresh"		f.refresh
X! "Focus on Root"		f.focus
X  "Source .twmrc"		f.twmrc
X  "Source blob"		f.source "blob"
X  "Cut File"		f.cutfile
X  "twm Version"		f.version
X  "Kill twm"		f.quit
X  }
X  
X--- 58,75 ----
X  {
X  "Window Ops"		f.title
X  "Refresh"		f.refresh
X! "Focus on Root"		f.unfocus
X  "Source .twmrc"		f.twmrc
X  "Source blob"		f.source "blob"
X  "Cut File"		f.cutfile
X  "twm Version"		f.version
X+ "(De)Iconify"		f.iconify
X+ "Move Window"		f.move
X+ "Resize Window"		f.resize
X+ "Raise Window"		f.raise
X+ "Lower Window"		f.lower
X+ "Focus on Window"	f.focus
X+ "Destroy Window"	f.destroy
X  "Kill twm"		f.quit
X  }
X  
X*** gc.h	Fri Apr 29 07:23:53 1988
X--- ../gc.h	Tue Apr 26 08:04:56 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: gc.h,v 1.2 88/04/15 07:09:52 tlastran Exp $
X   *
X   * GC related externs
X   *
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: gc.h,v 1.3 88/04/26 08:03:04 tlastran Exp $
X   *
X   * GC related externs
X   *
X*** list.h	Fri Apr 29 07:23:54 1988
X--- ../list.h	Tue Apr 26 08:03:56 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: list.h,v 1.2 88/04/15 07:10:08 tlastran Exp $
X   *
X   * TWM list handling external definitions
X   *
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: list.h,v 1.3 88/04/26 08:03:17 tlastran Exp $
X   *
X   * TWM list handling external definitions
X   *
X*** resize.c	Fri Apr 29 07:23:49 1988
X--- ../resize.c	Fri Apr 29 06:26:34 1988
X***************
X*** 25,31 ****
X  
X  /***********************************************************************
X   *
X!  * $Header: resize.c,v 1.6 88/04/15 07:09:35 tlastran Exp $
X   *
X   * window resizing borrowed from the "wm" window manager
X   *
X--- 25,31 ----
X  
X  /***********************************************************************
X   *
X!  * $Header: resize.c,v 1.10 88/04/29 06:24:01 tlastran Exp $
X   *
X   * window resizing borrowed from the "wm" window manager
X   *
X***************
X*** 35,41 ****
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: resize.c,v 1.6 88/04/15 07:09:35 tlastran Exp $";
X  #endif
X  
X  #include <stdio.h>
X--- 35,41 ----
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: resize.c,v 1.10 88/04/29 06:24:01 tlastran Exp $";
X  #endif
X  
X  #include <stdio.h>
X***************
X*** 42,49 ****
X--- 42,54 ----
X  #include "twm.h"
X  #include "util.h"
X  #include "resize.h"
X+ #include "add_window.h"
X  #include "resize.bm"
X+ #ifndef NOFOCUS
X  #include "focus.bm"
X+ #else
X+ #define focus_width 0
X+ #endif
X  
X  #define MINHEIGHT 32
X  #define MINWIDTH 60
X***************
X*** 83,89 ****
X      Window      junkRoot;
X      int         junkbw, junkDepth;
X  
X-     XMapRaised(dpy, SizeWindow);
X      ResizeWindow = tmp_win->frame;
X      XGrabServer(dpy);
X      XGrabPointer(dpy, ev.xbutton.root, True,
X--- 88,93 ----
X***************
X*** 102,107 ****
X--- 106,113 ----
X      origHeight = dragHeight;
X      clampTop = clampBottom = clampLeft = clampRight = 0;
X  
X+     XMoveWindow(dpy, SizeWindow, 0, 0);
X+     XMapRaised(dpy, SizeWindow);
X      DisplaySize(tmp_win, origWidth, origHeight);
X  }
X  
X***************
X*** 108,113 ****
X--- 114,157 ----
X  /***********************************************************************
X   *
X   *  Procedure:
X+  *	AddStartResize - begin a window resize operation from AddWindow
X+  *
X+  *  Inputs:
X+  *	tmp_win	- the TwmWindow pointer
X+  *
X+  ***********************************************************************
X+  */
X+ 
X+ void
X+ AddStartResize(tmp_win, x, y, w, h)
X+ TwmWindow *tmp_win;
X+ int x, y, w, h;
X+ {
X+     Window      junkRoot;
X+     int         junkbw, junkDepth;
X+ 
X+     XGrabServer(dpy);
X+     XGrabPointer(dpy, Root, True,
X+ 	ButtonReleaseMask | PointerMotionMask,
X+ 	GrabModeAsync, GrabModeSync,
X+ 	Root, MoveCursor, CurrentTime);
X+ 
X+     dragx = x + BorderWidth;
X+     dragy = y + BorderWidth;
X+     origx = dragx;
X+     origy = dragy;
X+     dragWidth = origWidth = w - 2 * BorderWidth;
X+     dragHeight = origHeight = h - 2 * BorderWidth;
X+     clampTop = clampBottom = clampLeft = clampRight = 0;
X+ 
X+     XMoveWindow(dpy, SizeWindow, 0, InitialFontHeight + 4 + BW);
X+     XMapRaised(dpy, SizeWindow);
X+     DisplaySize(tmp_win, origWidth, origHeight);
X+ }
X+ 
X+ /***********************************************************************
X+  *
X+  *  Procedure:
X   *	DoResize - move the rubberband around.  This is called for
X   *		   each motion event when we are resizing 
X   *
X***************
X*** 252,258 ****
X  
X      sprintf(str, "%d x %d", dwidth, dheight);
X  
X!     width = XTextWidth(SizeFont, str, strlen(str)) + 20,
X      strcat(str, "        ");
X      XResizeWindow(dpy, SizeWindow, width, SizeFontHeight + 4);
X      XRaiseWindow(dpy, SizeWindow);
X--- 296,302 ----
X  
X      sprintf(str, "%d x %d", dwidth, dheight);
X  
X!     width = XTextWidth(SizeFont, str, strlen(str)) + 20;
X      strcat(str, "        ");
X      XResizeWindow(dpy, SizeWindow, width, SizeFontHeight + 4);
X      XRaiseWindow(dpy, SizeWindow);
X***************
X*** 273,278 ****
X--- 317,326 ----
X  {
X      TwmWindow *tmp_win;
X  
X+ #ifdef DEBUG
X+     fprintf(stderr, "EndResize\n");
X+ #endif
X+ 
X      XUnmapWindow(dpy, SizeWindow);
X      MoveOutline(Root, 0, 0, 0, 0);
X  
X***************
X*** 315,320 ****
X--- 363,416 ----
X  /***********************************************************************
X   *
X   *  Procedure:
X+  *	AddEndResize - finish the resize operation for AddWindow
X+  *
X+  ***********************************************************************
X+  */
X+ 
X+ void
X+ AddEndResize(tmp_win)
X+ TwmWindow *tmp_win;
X+ {
X+ 
X+ #ifdef DEBUG
X+     fprintf(stderr, "AddEndResize\n");
X+ #endif
X+ 
X+     XUnmapWindow(dpy, SizeWindow);
X+ 
X+     dragHeight = dragHeight - tmp_win->title_height;
X+ 
X+     if (tmp_win->hints.flags&PMinSize && tmp_win->hints.flags & PResizeInc)
X+     {
X+ 	dragWidth -= tmp_win->hints.min_width;
X+ 	dragHeight -= tmp_win->hints.min_height;
X+     }
X+ 
X+     if (tmp_win->hints.flags & PResizeInc)
X+     {
X+ 	dragWidth /= tmp_win->hints.width_inc;
X+ 	dragHeight /= tmp_win->hints.height_inc;
X+ 
X+ 	dragWidth *= tmp_win->hints.width_inc;
X+ 	dragHeight *= tmp_win->hints.height_inc;
X+     }
X+ 
X+     if (tmp_win->hints.flags&PMinSize && tmp_win->hints.flags & PResizeInc)
X+     {
X+ 	dragWidth += tmp_win->hints.min_width;
X+ 	dragHeight += tmp_win->hints.min_height;
X+     }
X+ 
X+     AddingX = dragx;
X+     AddingY = dragy;
X+     AddingW = dragWidth;
X+     AddingH = dragHeight;
X+ }
X+ 
X+ /***********************************************************************
X+  *
X+  *  Procedure:
X   *	SetupWindow - set window sizes, this was called from either
X   *		AddWindow, EndResize, or HandleConfigureNotify.
X   *
X***************
X*** 337,342 ****
X--- 433,443 ----
X      unsigned int   xwcm;
X      int width;
X  
X+ #ifdef DEBUG
X+     fprintf(stderr, "SetupWindow: x=%d, y=%d, w=%d, h=%d\n",
X+ 	x, y, w, h);
X+ #endif
X+ 
X      tmp_win->frame_x = x;
X      tmp_win->frame_y = y;
X  
X***************
X*** 362,368 ****
X--- 463,471 ----
X      XConfigureWindow(dpy, tmp_win->resize_w, xwcm, &xwc);
X  
X      xwc.x = w - resize_width - focus_width - 3;
X+ #ifndef NOFOCUS
X      XConfigureWindow(dpy, tmp_win->focus_w, xwcm, &xwc);
X+ #endif
X  
X      width = w - TitleBarX - focus_width - resize_width - 5 -
X  	tmp_win->name_width - 10;
X*** util.h	Fri Apr 29 07:23:58 1988
X--- ../util.h	Thu Apr 28 06:30:06 1988
X***************
X*** 25,31 ****
X  
X  /***********************************************************************
X   *
X!  * $Header: util.h,v 1.4 88/04/15 07:09:41 tlastran Exp $
X   *
X   * utility routines header file
X   *
X--- 25,31 ----
X  
X  /***********************************************************************
X   *
X!  * $Header: util.h,v 1.5 88/04/26 08:02:56 tlastran Exp $
X   *
X   * utility routines header file
X   *
X*** add_window.c	Fri Apr 29 07:23:42 1988
X--- ../add_window.c	Fri Apr 29 06:24:50 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: add_window.c,v 1.7 88/04/15 07:10:05 tlastran Exp $
X   *
X   * Add a new window, put the titlbar and other stuff around
X   * the window
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: add_window.c,v 1.12 88/04/29 06:24:13 tlastran Exp $
X   *
X   * Add a new window, put the titlbar and other stuff around
X   * the window
X***************
X*** 36,42 ****
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: add_window.c,v 1.7 88/04/15 07:10:05 tlastran Exp $";
X  #endif lint
X  
X  #include <stdio.h>
X--- 36,42 ----
X  
X  #ifndef lint
X  static char RCSinfo[]=
X! "$Header: add_window.c,v 1.12 88/04/29 06:24:13 tlastran Exp $";
X  #endif lint
X  
X  #include <stdio.h>
X***************
X*** 45,59 ****
X  #include "resize.h"
X  #include "gram.h"
X  #include "list.h"
X  
X  #include "iconify.bm"
X  #include "resize.bm"
X  #include "xterm.bm"
X  #include "focus.bm"
X  #include "hilite.bm"
X  
X! static char NoName[] = "No Name"; /* name if no name is specified */
X  
X  /***********************************************************************
X   *
X   *  Procedure:
X--- 45,70 ----
X  #include "resize.h"
X  #include "gram.h"
X  #include "list.h"
X+ #include "events.h"
X  
X  #include "iconify.bm"
X  #include "resize.bm"
X  #include "xterm.bm"
X+ #ifndef NOFOCUS
X  #include "focus.bm"
X+ #else
X+ #define focus_width 0
X+ #endif
X  #include "hilite.bm"
X  
X! int AddingWindow = 0;		/* adding window count */
X! int AddingX;
X! int AddingY;
X! int AddingW;
X! int AddingH;
X  
X+ char NoName[] = "No Name"; /* name if no name is specified */
X+ 
X  /***********************************************************************
X   *
X   *  Procedure:
X***************
X*** 82,87 ****
X--- 93,99 ----
X      Pixmap pm;			/* tmp pixmap variable */
X      XWindowChanges xwc;		/* change window structure */
X      unsigned int xwcm;		/* change window mask */
X+     int dont_know;		/* don't know where to put the window */
X  
X  #ifdef DEBUG
X      fprintf(stderr, "AddWindow: w = 0x%x\n", w);
X***************
X*** 93,98 ****
X--- 105,113 ----
X  
X      XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr);
X      XFetchName(dpy, tmp_win->w, &tmp_win->name);
X+     tmp_win->class = NoClass;
X+     XGetClassHint(dpy, tmp_win->w, &tmp_win->class);
X+ 
X  #ifdef DEBUG
X      fprintf(stderr, "  name = \"%s\"\n", tmp_win->name);
X  #endif
X***************
X*** 100,105 ****
X--- 115,127 ----
X      if (XGetNormalHints(dpy, tmp_win->w, &tmp_win->hints) == 0)
X  	tmp_win->hints.flags = 0;
X  
X+     if (strncmp("xterm", tmp_win->class.res_name, 5) == 0 ||
X+     	strncmp("xterm", tmp_win->class.res_class, 5) == 0)
X+ 	tmp_win->xterm = TRUE;
X+     else
X+ 	tmp_win->xterm = FALSE;
X+ 
X+     dont_know = TRUE;
X      if (tmp_win->hints.flags & PSize)
X      {
X  #ifdef DEBUG
X***************
X*** 115,120 ****
X--- 137,143 ----
X  #ifdef DEBUG
X  	fprintf(stderr, "  user specified hints\n");
X  #endif
X+ 	dont_know = FALSE;
X  	tmp_win->attr.x = tmp_win->hints.x;
X  	tmp_win->attr.y = tmp_win->hints.y;
X  	tmp_win->attr.width = tmp_win->hints.width;
X***************
X*** 123,137 ****
X  
X      if (tmp_win->name == NULL)
X  	tmp_win->name = NoName;
X  
X!     tmp_win->auto_raise = LookInList(AUTO_RAISE, tmp_win->name);
X!     if (LookInList(NO_TITLE, tmp_win->name))
X!     {
X  	tmp_win->title_height = 0;
X-     }
X      else
X-     {
X  	tmp_win->title_height = TITLE_BAR_HEIGHT + BorderWidth;
X      }
X  
X      if (tmp_win->attr.y < tmp_win->title_height)
X--- 146,245 ----
X  
X      if (tmp_win->name == NULL)
X  	tmp_win->name = NoName;
X+     if (tmp_win->class.res_name == NULL)
X+     	tmp_win->class.res_name = NoName;
X+     if (tmp_win->class.res_class == NULL)
X+     	tmp_win->class.res_class = NoName;
X  
X!     tmp_win->full_name = tmp_win->name;
X! 
X!     if (strncmp("xterm_", tmp_win->name, 6) == 0)
X! 	tmp_win->name = &tmp_win->name[6];
X! 
X!     tmp_win->auto_raise = LookInList(AUTO_RAISE, tmp_win->full_name, 
X!      &tmp_win->class);
X!     if (LookInList(NO_TITLE, tmp_win->full_name, &tmp_win->class))
X  	tmp_win->title_height = 0;
X      else
X  	tmp_win->title_height = TITLE_BAR_HEIGHT + BorderWidth;
X+ 
X+     if (HandlingEvents && dont_know)
X+     {
X+ 	if (tmp_win->xterm || (tmp_win->attr.x == 0 && tmp_win->attr.y == 0))
X+ 	{
X+ 	    width = XTextWidth(InitialFont, tmp_win->name,
X+ 		strlen(tmp_win->name)) + 20;
X+ 	    XResizeWindow(dpy, InitialWindow, width, InitialFontHeight + 4);
X+ 	    XMapRaised(dpy, InitialWindow);
X+ 	    XDrawImageString(dpy, InitialWindow, InitialNormalGC,
X+ 		10, 2 + InitialFont->ascent,
X+ 		tmp_win->name, strlen(tmp_win->name));
X+ 
X+ 	    AddingW = tmp_win->attr.width;
X+ 	    AddingH = tmp_win->attr.height;
X+ 	    AddingWindow += 1;
X+ 
X+ 	    XGrabPointer(dpy, Root, True,
X+ 		0,
X+ 		GrabModeAsync, GrabModeSync,
X+ 		Root, UpperLeftCursor, CurrentTime);
X+ 
X+ 	    AddingW = tmp_win->attr.width + 2 * BorderWidth;
X+ 	    AddingH = tmp_win->attr.height + tmp_win->title_height +
X+ 		2 * BorderWidth;
X+ 
X+ 	    while (TRUE)
X+ 	    {
X+ 		XQueryPointer(dpy, Root, &JunkRoot, &JunkChild,
X+ 		    &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
X+ 
X+ 		MoveOutline(Root, AddingX, AddingY, AddingW, AddingH);
X+ 
X+ 		if (JunkMask & (Button1Mask | Button2Mask | Button3Mask))
X+ 		    break;
X+ 	    }
X+ 
X+ 	    if (JunkMask & Button2Mask)
X+ 	    {
X+ 		XWarpPointer(dpy, None, Root, 0, 0, 0, 0,
X+ 		    AddingX + AddingW/2, AddingY + AddingH/2);
X+ 		AddStartResize(tmp_win, AddingX, AddingY, AddingW, AddingH);
X+ 
X+ 		while (TRUE)
X+ 		{
X+ 		    XEvent ev;
X+ 		    int lastx, lasty;
X+ 
X+ 		    XQueryPointer(dpy, Root, &JunkRoot, &JunkChild,
X+ 			&JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
X+ 
X+ 		    if (lastx != AddingX || lasty != AddingY)
X+ 		    {
X+ 			ev.xmotion.x_root = AddingX;
X+ 			ev.xmotion.y_root = AddingY;
X+ 
X+ 			DoResize(ev, tmp_win);
X+ 
X+ 			lastx = AddingX;
X+ 			lasty = AddingY;
X+ 		    }
X+ 
X+ 		    if (!(JunkMask & Button2Mask))
X+ 		    {
X+ 			AddEndResize(tmp_win);
X+ 			break;
X+ 		    }
X+ 		}
X+ 	    }
X+ 
X+ 	    MoveOutline(Root, 0, 0, 0, 0);
X+ 	    XUnmapWindow(dpy, InitialWindow);
X+ 
X+ 	    tmp_win->attr.x = AddingX;
X+ 	    tmp_win->attr.y = AddingY + tmp_win->title_height;
X+ 	    tmp_win->attr.width = AddingW;
X+ 	    tmp_win->attr.height = AddingH;
X+ 	}
X      }
X  
X      if (tmp_win->attr.y < tmp_win->title_height)
X***************
X*** 154,173 ****
X  
X      XConfigureWindow(dpy, tmp_win->w, xwcm, &xwc);
X  
X- 
X-     tmp_win->full_name = tmp_win->name;
X- 
X-     if (strncmp("xterm", tmp_win->name, 5) == 0 ||
X- 	strncmp("yterm", tmp_win->name, 5) == 0 ||
X- 	strncmp("console", tmp_win->name, 7) == 0 ||
X- 	strncmp("login", tmp_win->name, 5) == 0)
X- 	tmp_win->xterm = TRUE;
X-     else
X- 	tmp_win->xterm = FALSE;
X- 
X-     if (strncmp("xterm_", tmp_win->name, 6) == 0)
X- 	tmp_win->name = &tmp_win->name[6];
X- 
X      tmp_win->name_width = XTextWidth(TitleBarFont, tmp_win->name,
X  	strlen(tmp_win->name));
X      tmp_win->icon_name = tmp_win->name;
X--- 262,267 ----
X***************
X*** 195,200 ****
X--- 289,296 ----
X  	BorderWidth,
X  	Foreground, Background);
X  
X+     XSetWindowBorderPixmap(dpy, tmp_win->frame, GrayTile);
X+     
X      tmp_win->title_w = XCreateSimpleWindow(dpy, tmp_win->frame,
X  	-BorderWidth, -BorderWidth,
X  	tmp_win->attr.width, TITLE_BAR_HEIGHT,
X***************
X*** 201,206 ****
X--- 297,304 ----
X  	BorderWidth,
X  	Foreground, Background);
X  
X+     XSetWindowBorderPixmap(dpy, tmp_win->title_w, GrayTile);
X+ 
X      /* the three buttons have the pixmap as the background of the
X       * window, that way I don't have to worry about repainting them
X       * on expose events.
X***************
X*** 217,222 ****
X--- 315,321 ----
X  	0, DefaultDepth(dpy, 0), CopyFromParent, DefaultVisual(dpy,0),
X  	valuemask, &attributes);
X  
X+ #ifndef NOFOCUS
X      attributes.background_pixmap = MakePixmap(tmp_win->title_w, TitleNormalGC,
X  	focus_bits, focus_width, focus_height);
X  
X***************
X*** 225,230 ****
X--- 324,330 ----
X  	iconify_width, iconify_height,
X  	0, DefaultDepth(dpy, 0), CopyFromParent, DefaultVisual(dpy,0),
X  	valuemask, &attributes);
X+ #endif
X  
X      attributes.background_pixmap = MakePixmap(tmp_win->title_w, TitleNormalGC,
X  	resize_bits, resize_width, resize_height);
X***************
X*** 248,254 ****
X--- 348,356 ----
X  	
X      XDefineCursor(dpy, tmp_win->title_w, ArrowCursor);
X      XDefineCursor(dpy, tmp_win->iconify_w, ButtonCursor);
X+ #ifndef NOFOCUS
X      XDefineCursor(dpy, tmp_win->focus_w, ButtonCursor);
X+ #endif
X      XDefineCursor(dpy, tmp_win->resize_w, ButtonCursor);
X  
X      XSelectInput(dpy, tmp_win->w, StructureNotifyMask);
X***************
X*** 377,383 ****
X--- 479,487 ----
X      XSaveContext(dpy, tmp_win->iconify_w, TwmContext, tmp_win);
X      XSaveContext(dpy, tmp_win->resize_w, TwmContext, tmp_win);
X      XSaveContext(dpy, tmp_win->icon_w, TwmContext, tmp_win);
X+ #ifndef NOFOCUS
X      XSaveContext(dpy, tmp_win->focus_w, TwmContext, tmp_win);
X+ #endif
X      XSaveContext(dpy, tmp_win->hilite_w, TwmContext, tmp_win);
X  
X      return (tmp_win);
X*** gram.h	Fri Apr 29 07:23:53 1988
X--- ../gram.h	Fri Apr 29 06:45:35 1988
X***************
X*** 12,18 ****
X  # define BUTTON 261
X  # define TBUTTON 262
X  # define F_MENU 263
X! # define F_FOCUS 264
X  # define F_REFRESH 265
X  # define F_FILE 266
X  # define F_TWMRC 267
X--- 12,18 ----
X  # define BUTTON 261
X  # define TBUTTON 262
X  # define F_MENU 263
X! # define F_UNFOCUS 264
X  # define F_REFRESH 265
X  # define F_FILE 266
X  # define F_TWMRC 267
X***************
X*** 26,44 ****
X  # define F_CIRCLEDOWN 275
X  # define F_SOURCE 276
X  # define F_CUTFILE 277
X! # define T_NOP 278
X! # define T_RAISE 279
X! # define T_LOWER 280
X! # define T_MOVE 281
X! # define WARPCURSOR 282
X! # define NUMBER 283
X! # define BORDERWIDTH 284
X! # define TITLE_FONT 285
X! # define REVERSE_VIDEO 286
X! # define RESIZE_FONT 287
X! # define NO_TITLE 288
X! # define AUTO_RAISE 289
X! # define MENU_FONT 290
X! # define ICON_FONT 291
X! # define UNKNOWN_ICON 292
X! # define STRING 293
X--- 26,51 ----
X  # define F_CIRCLEDOWN 275
X  # define F_SOURCE 276
X  # define F_CUTFILE 277
X! # define F_MOVE 278
X! # define F_ICONIFY 279
X! # define F_FOCUS 280
X! # define F_RESIZE 281
X! # define F_RAISE 282
X! # define F_LOWER 283
X! # define T_NOP 284
X! # define T_RAISE 285
X! # define T_LOWER 286
X! # define T_MOVE 287
X! # define F_DESTROY 288
X! # define WARPCURSOR 289
X! # define NUMBER 290
X! # define BORDERWIDTH 291
X! # define TITLE_FONT 292
X! # define REVERSE_VIDEO 293
X! # define RESIZE_FONT 294
X! # define NO_TITLE 295
X! # define AUTO_RAISE 296
X! # define MENU_FONT 297
X! # define ICON_FONT 298
X! # define UNKNOWN_ICON 299
X! # define STRING 300
X*** menus.c	Fri Apr 29 07:23:47 1988
X--- ../menus.c	Fri Apr 29 06:26:09 1988
X***************
X*** 25,31 ****
X  
X  /***********************************************************************
X   *
X!  * $Header: menus.c,v 1.20 88/04/15 07:09:54 tlastran Exp $
X   *
X   * twm menu code
X   *
X--- 25,31 ----
X  
X  /***********************************************************************
X   *
X!  * $Header: menus.c,v 1.25 88/04/29 06:24:10 tlastran Exp $
X   *
X   * twm menu code
X   *
X***************
X*** 35,41 ****
X  
X  #ifndef lint
X  static char RCSinfo[] =
X! "$Header: menus.c,v 1.20 88/04/15 07:09:54 tlastran Exp $";
X  #endif
X  
X  #include <stdio.h>
X--- 35,41 ----
X  
X  #ifndef lint
X  static char RCSinfo[] =
X! "$Header: menus.c,v 1.25 88/04/29 06:24:10 tlastran Exp $";
X  #endif
X  
X  #include <stdio.h>
X***************
X*** 49,54 ****
X--- 49,55 ----
X  
X  #include "pull.bm"
X  
X+ int RootFunction = NULL;
X  MenuRoot *Menu[MAX_BUTTONS + 1];	/* one root per button */
X  MenuItem *Item[MAX_BUTTONS + 1];	/* one action per button */
X  MenuRoot *MenuList = NULL;		/* head of the menu list */
X***************
X*** 194,199 ****
X--- 195,202 ----
X      tmp->func = func;
X  
X      width = XTextWidth(MenuFont, item, strlen(item));
X+     if (width <= 0)
X+ 	width = 1;
X      if (width > menu->width)
X  	menu->width = width;
X  
X***************
X*** 410,415 ****
X--- 413,452 ----
X      case F_TITLE:
X  	break;
X  
X+     case F_RESIZE:
X+     case F_MOVE:
X+ 	XGrabPointer(dpy, Root, True,
X+ 	    ButtonReleaseMask | ButtonMotionMask,
X+ 	    GrabModeAsync, GrabModeSync,
X+ 	    Root, MoveCursor, CurrentTime);
X+ 
X+ 	RootFunction = menu->func;
X+ 	return;
X+ 	break;
X+ 
X+     case F_ICONIFY:
X+     case F_RAISE:
X+     case F_LOWER:
X+     case F_FOCUS:
X+ 	XGrabPointer(dpy, Root, True,
X+ 	    ButtonReleaseMask | ButtonMotionMask,
X+ 	    GrabModeAsync, GrabModeSync,
X+ 	    Root, DotCursor, CurrentTime);
X+ 
X+ 	RootFunction = menu->func;
X+ 	return;
X+ 	break;
X+ 
X+     case F_DESTROY:
X+ 	XGrabPointer(dpy, Root, True,
X+ 	    ButtonReleaseMask | ButtonMotionMask,
X+ 	    GrabModeAsync, GrabModeSync,
X+ 	    Root, SkullCursor, CurrentTime);
X+ 
X+ 	RootFunction = menu->func;
X+ 	return;
X+ 	break;
X+ 
X      case F_CIRCLEUP:
X  	XCirculateSubwindowsUp(dpy, Root);
X  	break;
X***************
X*** 426,432 ****
X  	Execute(menu->action);
X  	break;
X  
X!     case F_FOCUS:
X  	FocusOnRoot();
X  	break;
X  
X--- 463,469 ----
X  	Execute(menu->action);
X  	break;
X  
X!     case F_UNFOCUS:
X  	FocusOnRoot();
X  	break;
X  
X***************
X*** 447,453 ****
X  		{
X  		    count = read(fd, buff, MAX_FILE_SIZE - 1);
X  		    if (count > 0)
X! 			XStoreBytes(dpy, buff, strlen(buff));
X  
X  		    close(fd);
X  		}
X--- 484,490 ----
X  		{
X  		    count = read(fd, buff, MAX_FILE_SIZE - 1);
X  		    if (count > 0)
X! 			XStoreBytes(dpy, buff, count);
X  
X  		    close(fd);
X  		}
X***************
X*** 470,476 ****
X  	{
X  	    count = read(fd, buff, MAX_FILE_SIZE - 1);
X  	    if (count > 0)
X! 		XStoreBytes(dpy, buff, strlen(buff));
X  
X  	    close(fd);
X  	}
X--- 507,513 ----
X  	{
X  	    count = read(fd, buff, MAX_FILE_SIZE - 1);
X  	    if (count > 0)
X! 		XStoreBytes(dpy, buff, count);
X  
X  	    close(fd);
X  	}
X***************
X*** 547,552 ****
X--- 584,590 ----
X  	Done();
X  	break;
X      }
X+     XUngrabPointer(dpy, CurrentTime);
X  }
X  
X  /***********************************************************************
X*** resize.h	Fri Apr 29 07:23:57 1988
X--- ../resize.h	Tue Apr 26 08:04:28 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: resize.h,v 1.4 88/04/15 07:09:37 tlastran Exp $
X   *
X   * resize function externs
X   *
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: resize.h,v 1.5 88/04/26 08:02:53 tlastran Exp $
X   *
X   * resize function externs
X   *
X*** version.c	Fri Apr 29 07:23:50 1988
X--- ../version.c	Fri Apr 29 06:26:50 1988
X***************
X*** 25,31 ****
X  
X  /***********************************************************************
X   *
X!  * $Header: version.c,v 2.0 88/04/15 07:00:36 tlastran Exp $
X   *
X   * twm version number
X   *
X--- 25,31 ----
X  
X  /***********************************************************************
X   *
X!  * $Header: version.c,v 2.7 88/04/29 06:24:26 tlastran Exp $
X   *
X   * twm version number
X   *
X***************
X*** 34,40 ****
X   ***********************************************************************/
X  
X  static char RCSinfo[]=
X! "$Header: version.c,v 2.0 88/04/15 07:00:36 tlastran Exp $";
X  
X! char *Revision = "$Revision: 2.0 $";
X! char *Date = "$Date: 88/04/15 07:00:36 $";
X--- 34,40 ----
X   ***********************************************************************/
X  
X  static char RCSinfo[]=
X! "$Header: version.c,v 2.7 88/04/29 06:24:26 tlastran Exp $";
X  
X! char *Revision = "$Revision: 2.7 $";
X! char *Date = "$Date: 88/04/29 06:24:26 $";
X*** add_window.h	Fri Apr 29 07:23:51 1988
X--- ../add_window.h	Wed Apr 27 10:44:08 1988
X***************
X*** 25,31 ****
X  
X  /**********************************************************************
X   *
X!  * $Header: add_window.h,v 1.3 88/04/15 07:10:07 tlastran Exp $
X   *
X   * AddWindow include file
X   *
X--- 25,31 ----
X  
X  /**********************************************************************
X   *
X!  * $Header: add_window.h,v 1.6 88/04/27 10:43:01 tlastran Exp $
X   *
X   * AddWindow include file
X   *
X***************
X*** 36,43 ****
X--- 36,50 ----
X  #ifndef _ADD_WINDOW_
X  #define _ADD_WINDOW_
X  
X+ extern char NoName[];
X+ 
X  extern TwmWindow *AddWindow();
X  extern int MappedNotOverride();
X+ extern int AddingWindow;
X+ extern int AddingX;	
X+ extern int AddingY;
X+ extern int AddingW;
X+ extern int AddingH;
X  
X  #endif _ADD_WINDOW_
X  
SHAR_EOF
if test 32374 -ne "`wc -c < twm.patches1`"
then
    echo shar: error transmitting "twm.patches1" '(should have been 32374 characters)'
fi
fi
# end of shell archive
exit 0