[comp.sources.x] v04i035: dwim -- "Do What I Mean" Window Manager, Patch1

argv@island.uu.net (Dan Heller) (06/29/89)

Submitted-by: davidra@tcgould.tn.cornell.edu (David Rabson)
Posting-number: Volume 4, Issue 35
Archive-name: dwim-twm.patch/patch1

[ This is -not- an official twm patch.  Altho this patch applies to twm,
  it is not from "Tom" and is not intended to be official.  I did not
  test this patch since I have none of the 3 "official" twm patches which
  this program apparently requires before this patch can be applied. --argv ]

DWIM is a short patch to twm (Tom's Window Manager, Copyright 1988 Evans
and Sutherland) to enable a user to switch back and forth between windows
without ever having to touch the mouse.

Example: once you have set up your .dwimrc correctly, your windows will
all have numbered title bars, and you will be able to say control-4 to
(simultaneously) move the mouse and input focus to window 4, deiconify
window 4 if it's an icon, and raise window 4.

There follows a patch file that can be used on the twm distribution of
10/88 *WITH* 3 patches applied.  I will make the whole thing available
for ftp if there is sufficient demand.

This has been tested on sun 3's running BSD 4.2 (SunOs 3.4) and X11R2 and
an IBM PC/RT running BSD 4.3 (AOS) and X11R3.

David Rabson
davidra@helios.tn.cornell.edu

------------------------------------------------------------------------------

diff -c twm/Imakefile dwim/Imakefile
*** twm/Imakefile	Fri Oct 14 19:41:26 1988
--- dwim/Imakefile	Fri Jun 23 19:02:01 1989
***************
*** 11,20 ****
           YFLAGS = -d
  
  SRCS1=	add_window.c gc.c list.c twm.c parse.c\
!         menus.c events.c resize.c util.c version.c
  
  OBJS1=	gram.o lex.o add_window.o gc.o list.o twm.o parse.o\
!         menus.o events.o resize.o util.o version.o
  
  ComplexProgramTarget_1(twm,$(LOCAL_LIBRARIES),)
  
--- 11,20 ----
           YFLAGS = -d
  
  SRCS1=	add_window.c gc.c list.c twm.c parse.c\
!         menus.c events.c resize.c util.c version.c dwim.c
  
  OBJS1=	gram.o lex.o add_window.o gc.o list.o twm.o parse.o\
!         menus.o events.o resize.o util.o version.o dwim.o
  
  ComplexProgramTarget_1(twm,$(LOCAL_LIBRARIES),)
  
diff -c twm/Makefile dwim/Makefile
*** twm/Makefile	Thu Nov 17 08:08:33 1988
--- dwim/Makefile	Fri Jun 23 20:47:55 1989
***************
*** 19,24 ****
--- 19,25 ----
  #
  #LIBS= -lX11 -lXrm
  LIBS= -lX11
+ #LIBS = libX11.a
  
  #
  # -DNOFOCUS  causes the focus button in the title bar to be compiled out 
***************
*** 43,55 ****
          events.o\
          resize.o\
          util.o\
          version.o
  
  
! all:	twm
  
! twm:	$(O_FILES)
! 	cc $(LDFLAGS) -o twm $(O_FILES) $(LIBS)
  
  #
  #  Dependencies
--- 44,57 ----
          events.o\
          resize.o\
          util.o\
+ 	dwim.o\
          version.o
  
  
! all:	dwim
  
! dwim:	$(O_FILES)
! 	cc $(CFLAGS) $(LDFLAGS) -o dwim $(O_FILES) $(LIBS)
  
  #
  #  Dependencies
diff -c twm/add_window.c dwim/add_window.c
*** twm/add_window.c	Thu Apr 27 19:14:21 1989
--- dwim/add_window.c	Fri Jun 23 18:50:06 1989
***************
*** 34,39 ****
--- 34,41 ----
   *
   **********************************************************************/
  
+ /* DWIM modifactions David Rabson 6/89 */
+ 
  #ifndef lint
  static char RCSinfo[]=
  "$Header: add_window.c,v 1.50 88/10/13 07:19:19 toml Exp $";
***************
*** 142,147 ****
--- 144,155 ----
  	tmp_win->xterm = TRUE;
      else
  	tmp_win->xterm = FALSE;
+ 
+ /* BEGIN DWIM */
+     if(dwim_set)
+ 	/* titles become numbers in dwim -- goes after xterm test */
+ 	dwim_setname(&tmp_win->name,tmp_win);		/* in dwim.c */
+ /* END DWIM */
  
      dont_know = TRUE;
      if (tmp_win->hints.flags & PPosition)
diff -c twm/dwim.c dwim/dwim.c
*** twm/dwim.c	Fri Jun 23 19:23:06 1989
--- dwim/dwim.c	Fri Jun 23 18:56:44 1989
***************
*** 0 ****
--- 1,304 ----
+ /* dwim.c
+  *
+  * functions added to twm
+  *
+  * dwim_setname(sp, tw)
+  * char **sp;
+  * Window w, wf;
+  *
+  * Stuff sp with the name (number) of a new window and notes a new window's
+  * creation.  Wf is the window frame (which seems to be necessary to raise
+  * a window).
+  *
+  *
+  * dwim_demise(s)
+  * char *s;
+  *
+  * Note the demise of a window named s.  If !atoi(s), dwim ignores this.
+  *
+  *
+  * dwim_command()
+  *
+  * Grab the keyboard for a one-character command.  Execute it.
+  *
+  *
+  * dwim_intercept(ev)
+  * XEvent ev;
+  *
+  * Intercept a grabbed key stroke and decide what we want to do with it.
+  * Return 1 if the usual twm keystroke event routine should get it or 0
+  * if it shouldn't.
+  *
+  */
+ 
+ #include "twm.h"
+ #include <stdio.h>
+ #include <ctype.h>
+ #define ALLOC(x) (x *)malloc(sizeof(x))
+ #define NUMMODS	8			/* # of mods in XModifierMap */
+ 
+ /* globals (also in twm.h) */
+ int dwim_set = 1;
+ 
+ /* statics */
+ 
+ static int grabit=0;	/* are we currently grabbing the keyboard? */
+ 
+ struct dwim_wits {		/* used to hold the two important windows */
+ 	Window w, wf;
+ 	TwmWindow *tw;
+ };
+ 	
+ static int dwim_nextnum=1;
+ 
+ struct dwim_winlist {	/*list of windows*/
+ 	int num;
+ 	struct dwim_wits wins;
+ 	struct dwim_winlist *next;
+ } root={0};			/* root will be a fake to make things easier */
+ 
+ struct dwim_nlist {	/* list of free window numbers */
+ 	int n;
+ 	struct dwim_nlist *next;
+ } nroot={0,0};			/* again, a dummy root */
+ 
+ 
+ char *malloc();
+ 
+ 
+ /* Stuff sp with the name of a new window and note the window struct */
+ dwim_setname(sp,tw)
+ char **sp;
+ TwmWindow *tw;
+ {
+ 	char *buffer=malloc(4);	/* 4 is magic */
+ 	int num = newnum();
+ 
+ 	if(num < 1 || num > 999)
+ 		dwim_err("inconsistency in dwim_setname");
+ 
+ 	sprintf(buffer,"%d",num);
+ 	*sp = buffer;				/* stuff it */
+ 
+ 	addwin(num,tw);				/* below */
+ }
+ 
+ /* Note the demise of a window (take it off the list if it's on it) */
+ dwim_demise(w)
+ Window w;
+ {
+ 	struct dwim_winlist *node = root.next;
+ 	struct dwim_winlist *prev = &root;
+ 
+ 	while(node)	{
+ 		if( w == node->wins.w )	{	/* match? */
+ 			prev->next = node->next;
+ 			addfree(node->num);	/*below--add num to freelist*/
+ 			free(node);
+ 			break;			/* no need to continue */
+ 		}
+ 		prev = node;
+ 		node = node->next;
+ 	}
+ }
+ 
+ /* Grab the keyboard for one keystroke and execute it (shift keys are tricky).
+  * Since events are asyncronous in X (and I don't know how to get around this),
+  * the ungrabbing will have to take place in dwim_intercept() below.
+  *
+  * I think this is essentially like shifting the focus to the root window.
+  */
+ dwim_command()
+ {
+ 	XGrabKeyboard(dpy,
+ 		Root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
+ 
+ 	grabit=1;		/* let dwim_intercept, etc.,  know */
+ }
+ 
+ /* intercept an event; return 0 or 1 depending on whether twm should see it */
+ dwim_intercept(ev)
+ XEvent ev;
+ {
+ 	Window w = ev.xkey.window;
+ 	unsigned int keycode = ev.xkey.keycode;
+ 	unsigned int state = ev.xkey.state;		/* modifier mask */
+ 	char b, bu;		/* b is a char, bu is same char unshifted */
+ 	XEvent evc;		/* event copy used to get bu */
+ 
+ 	/* ignore modifiers (shift keys) -- wait for the real thing */
+ 	if(ismodifier(keycode))
+ 		return(1);		/* twm probably ignores it, too */
+ 
+ 	/* ungrab a grabbed keyboard */
+ 	if(grabit)	{
+ 		XUngrabKeyboard(dpy, CurrentTime);
+ 		grabit=0;
+ 	}
+ 
+ 	/* get the key (truncate translation to one character) */
+ 	XLookupString(&ev, &b, 1, NULL, NULL);	/* b is a char */
+ 	evc = ev;			/* NOTE: an XEvent is not a pointer */
+ 	evc.xkey.state = 0;		/* unshift it */
+ 	XLookupString(&evc, &bu, 1, NULL, NULL);	/* bu is unshifted */
+ 
+ 	return(dokey(b,bu,state));
+ }
+ 
+ /* continue to process intercepted key -- return same as dwim_intercept() */
+ static
+ dokey(b,bu,state)
+ char b,bu;				/* bu is unshifted char */
+ {
+ 	struct dwim_wits numtowinframe();
+ 
+ 	if( (dwim_set && isdigit(bu)) )	{
+ 		warpto(numtowinframe(bu-'0'));	/* may fail with EBSDC */
+ 		return(0);
+ 	}
+ 	return(1);
+ }
+ 
+ /* convert a number to a window  --  return Root if no match */
+ static
+ struct dwim_wits
+ numtowinframe(n)
+ {
+ 	struct dwim_winlist *node = root.next;
+ 	static struct dwim_wits rvalue;
+ 
+ 	while(node)	{
+ 		if(node->num == n)
+ 			return(node->wins);
+ 		node = node->next;
+ 	}
+ 	rvalue.w = rvalue.wf = Root;
+ 	rvalue.tw = &TwmRoot;
+ 	return(rvalue);		/* no match */
+ }
+ 
+ /* is the keycode a modifier (e.g., just the shift key) ? */
+ static
+ ismodifier(key)
+ unsigned int key;
+ {
+ 	static XModifierKeymap *map = 0;
+ 	static int max_keypermod;
+ 	KeyCode *m;		/* a NUMMODS x max_keypermod array */
+ 	int i;
+ 
+ 	if(!map)	{
+ 		map = XGetModifierMapping(dpy);
+ 		max_keypermod = map->max_keypermod;
+ 		m = map->modifiermap;
+ 	}
+ 
+ 	/* just try them out serially (there can't be too many...) */
+ 	i = max_keypermod*NUMMODS;	/* number of possibilities */
+ 	m = map->modifiermap;
+ 	do {
+ 		if(*m++ == key)
+ 			return(1);
+ 	} while(--i);
+ 
+ 	return(0);			/* no, it's not a modifier */
+ }
+ 
+ 
+ /* add a number to the list of free numbers */
+ static
+ addfree(n)
+ {
+ 	struct dwim_nlist *old = nroot.next;
+ 	struct dwim_nlist *new = ALLOC(struct dwim_nlist);
+ 
+ 	new->n = n;
+ 	nroot.next = new;
+ 	new->next = old;
+ }
+ 
+ /* get a new number */
+ static
+ newnum()
+ {
+ 	int n;
+ 	struct dwim_nlist *node;
+ 	if(node = nroot.next)	{
+ 		/* first try the freelist */
+ 		n = node->n;
+ 		nroot.next = node->next;
+ 		free(node);
+ 	} else
+ 		/* otherwise ... */
+ 		n = dwim_nextnum++;
+ 
+ 	return(n);
+ }
+ 
+ /* add a new window and frame to our list */
+ static
+ addwin(num,tw)
+ TwmWindow *tw;
+ {
+ 	struct dwim_winlist *old = root.next;
+ 	struct dwim_winlist *new = ALLOC(struct dwim_winlist);
+ 
+ 	/* fill the new node */
+ 	new->num      = num;
+ 	new->wins.w   = tw->w;
+ 	new->wins.wf  = tw->frame;
+ 	new->wins.tw  = tw;
+ 
+ 	/* insert the new node */
+ 	root.next = new;
+ 	new->next = old;
+ }
+ 
+ 
+ static
+ dwim_err(s)
+ char *s;
+ {
+ 	fprintf(stderr,"dwim: %s\n",s);
+ 	Done();				/* in twm.c */
+ }
+ 
+ /* a debugging routine */
+ static
+ wintraverse()
+ {
+ 	struct dwim_winlist *node = root.next;
+ 	printf("------ wintraverse ------\n");
+ 	while(node)	{
+ 		printf("%d 0x%09x\n",node->num,(unsigned int)node->wins.w);
+ 		node=node->next;
+ 	}
+ 	printf("-------------------------\n");
+ }
+ 
+ 
+ /* warp pointer and focus to window w */
+ static
+ warpto(dw)
+ struct dwim_wits dw;
+ {
+ 	XRaiseWindow(dpy, dw.w);		/* seems to do nothing */
+ 	XRaiseWindow(dpy, dw.wf);
+ 	DeIconify(dw.tw);			/* this might work */
+ 
+ 	/* warp to upper left corner of window */
+  	XWarpPointer(dpy, None, dw.w, 0, 0, 0, 0, 0, 0);
+ 
+ 	XSetInputFocus(dpy, dw.w, RevertToNone, CurrentTime);
+ }
+ 
+ /* get window width */
+ static
+ getwidth(w)
+ Window w;
+ {
+ 	XWindowAttributes buf;
+ 
+ 	XGetWindowAttributes(dpy, w, &buf);
+ 	return(buf.width);
+ }
diff -c twm/dwim.man dwim/dwim.man
*** twm/dwim.man	Fri Jun 23 19:23:01 1989
--- dwim/dwim.man	Fri Jun 23 19:39:36 1989
***************
*** 0 ****
--- 1,51 ----
+ .TH DWIM 1 "23 June 1989" "X Version 11"
+ .SH NAME
+ .PP
+ dwim - a window manager hack for X11 (Do What I Mean)
+ .PP
+ .SH SYNTAX
+ .PP
+ \fBdwim \fP[-display \fIdisplay\fP]
+ .PP
+ .SH DESCRIPTION
+ .PP
+ \fIdwim\fR is a set of patches to \fItwm\fR (Tom's Window Manager, \fIcf.\fR)
+ to do a small number of things with keystrokes that are more naturally done
+ with keystrokes than with the mouse.
+ .PP
+ \fIdwim\fR reads a file called \fI.dwimrc\fR instead of \fI.twmrc\fR.
+ .PP
+ Xterm's are labeled with numbers instead of the name "xterm."
+ Any digit typed in the root window will cause the focus to shift
+ to the window numbered by the same digit.  In addition, if a digit key
+ key is mapped in the \fI.dwimrc\fR (with or without shift modifiers),
+ \fIdwim\fR will intercept that key before \fItwm\fR sees it and will
+ cause the focus to be shifted.  When the focus is shifted, the appropriate
+ window is also raised or deiconified.
+ .PP
+ The function \fIf.dwimcom\fR effectively shifts the focus to the root window
+ for one keystroke only (shift-key, control-key, and meta-key all count as
+ one keystroke).
+ .PP
+ The usual way to use \fIdwm\fR is to add the following lines to a \fI.twmrc\fR
+ file:
+ .IP
+ .nf
+ "w" = m : window : f.dwimcom
+ "1" = c : window : f.nop
+ "2" = c : window : f.nop
+ "3" = c : window : f.nop
+ "4" = c : window : f.nop
+ "5" = c : window : f.nop
+ "6" = c : window : f.nop
+ "7" = c : window : f.nop
+ "8" = c : window : f.nop
+ "9" = c : window : f.nop
+ .fi
+ .PP
+ With these lines, \fImeta-w digit\fR or \fIcontrol-digit\fR will cause the
+ focus to be shifted to the given window.
+ .SH AUTHOR
+ David A. Rabson
+ \".SH BUGS
+ 
diff -c twm/events.c dwim/events.c
*** twm/events.c	Thu Apr 27 19:14:21 1989
--- dwim/events.c	Fri Jun 23 16:19:44 1989
***************
*** 33,38 ****
--- 33,40 ----
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  #ifndef lint
  static char RCSinfo[]=
  "$Header: events.c,v 1.91 88/10/14 07:06:12 toml Exp $";
***************
*** 223,231 ****
--- 225,243 ----
   ***********************************************************************
   */
  
+ /* DWIM modifications: intercept the event first */
  void
  HandleKeyPress()
  {
+     void TwmHandleKeyPress();
+ 
+     if(!dwim_set || dwim_intercept(event))
+ 	TwmHandleKeyPress();			/* let twm see it, maybe */
+ }
+ 
+ void static
+ TwmHandleKeyPress()
+ {
      FuncKey *key;
      int len;
  
***************
*** 622,627 ****
--- 634,641 ----
      tmp_win->prev->next = tmp_win->next;
      if (tmp_win->next != NULL)
  	tmp_win->next->prev = tmp_win->prev;
+ 
+     dwim_demise(tmp_win->w);	/* DWIM */
  
      free((char *)tmp_win);
  }
diff -c twm/gram.y dwim/gram.y
*** twm/gram.y	Thu Apr 27 19:18:46 1989
--- dwim/gram.y	Fri Jun 23 15:25:28 1989
***************
*** 33,38 ****
--- 33,40 ----
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  %{
  static char RCSinfo[]=
  "$Header: gram.y,v 1.45 88/10/14 07:05:55 toml Exp $";
***************
*** 73,79 ****
  %token <num> F_POPUP F_DEICONIFY F_FORCEMOVE WINDOW_FUNCTION
  %token <num> F_DESTROY F_WINREFRESH F_BEEP DONT_MOVE_OFF ZOOM
  %token <num> F_SHOWLIST F_HIDELIST NO_BACKINGSTORE NO_SAVEUNDER
! %token <num> F_ZOOM F_FULLZOOM
  %token <num> ICONMGR_FOREGROUND ICONMGR_BACKGROUND ICONMGR_FONT ICONMGR
  %token <num> ICONMGR_GEOMETRY SHOW_ICONMGR ICONMGR_NOSHOW
  %token <num> F_RAISELOWER DECORATE_TRANSIENTS RANDOM_PLACEMENT
--- 75,81 ----
  %token <num> F_POPUP F_DEICONIFY F_FORCEMOVE WINDOW_FUNCTION
  %token <num> F_DESTROY F_WINREFRESH F_BEEP DONT_MOVE_OFF ZOOM
  %token <num> F_SHOWLIST F_HIDELIST NO_BACKINGSTORE NO_SAVEUNDER
! %token <num> F_ZOOM F_FULLZOOM F_DWIMCOM
  %token <num> ICONMGR_FOREGROUND ICONMGR_BACKGROUND ICONMGR_FONT ICONMGR
  %token <num> ICONMGR_GEOMETRY SHOW_ICONMGR ICONMGR_NOSHOW
  %token <num> F_RAISELOWER DECORATE_TRANSIENTS RANDOM_PLACEMENT
***************
*** 89,94 ****
--- 91,97 ----
  %token <num> NO_RAISE_ON_MOVE NO_RAISE_ON_DEICONIFY NO_RAISE_ON_RESIZE
  %token <num> COLOR MONOCHROME NO_TITLE_FOCUS FUNCTION F_FUNCTION
  %token <num> BORDER_TILE_FOREGROUND BORDER_TILE_BACKGROUND
+ %token <num> DWIM_SET
  %token <ptr> STRING
  
  %type <ptr> string
***************
*** 105,110 ****
--- 108,114 ----
  		;
  
  stmt		: error
+ 		| DWIM_SET		{ if (FirstTime) dwim_set = 1; }
  		| FORCE_ICON		{ if (FirstTime) ForceIcon = TRUE; }
  		| REVERSE_VIDEO		{ if (FirstTime) ReverseVideo = TRUE; }
  		| ICON_FONT string	{ IconFont.name = $2;
***************
*** 416,421 ****
--- 420,426 ----
  		| F_EXEC string		{ Action = $2; $$ = F_EXEC; }
  		| F_CUT string		{ Action = $2; $$ = F_CUT; }
  		| F_FUNCTION string	{ Action = $2; $$ = F_FUNCTION; }
+ 		| F_DWIMCOM		{ $$ = F_DWIMCOM; }
  		;
  
  button		: BUTTON		{ $$ = $1;
diff -c twm/lex.l dwim/lex.l
*** twm/lex.l	Fri Oct 14 19:41:41 1988
--- dwim/lex.l	Fri Jun 23 15:25:58 1989
***************
*** 34,39 ****
--- 34,41 ----
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  static char RCSinfo[]=
  "$Header: lex.l,v 1.43 88/10/14 07:05:48 toml Exp $";
  
***************
*** 112,119 ****
  f.destroy			{ return F_DESTROY; }
  f.zoom				{ return F_ZOOM; }
  f.fullzoom			{ return F_FULLZOOM; }
  
- 
  t.nop				{ return F_NOP; }
  t.raise				{ return F_RAISE; }
  t.lower				{ return F_LOWER; }
--- 114,121 ----
  f.destroy			{ return F_DESTROY; }
  f.zoom				{ return F_ZOOM; }
  f.fullzoom			{ return F_FULLZOOM; }
+ f.dwimcom			{ return F_DWIMCOM; }
  
  t.nop				{ return F_NOP; }
  t.raise				{ return F_RAISE; }
  t.lower				{ return F_LOWER; }
***************
*** 138,143 ****
--- 140,146 ----
  [Nn][Oo][Tt][Ii][Tt][Ll][Ee]	{ return (NO_TITLE); }
  [Aa][Uu][Tt][Oo][Rr][Aa][Ii][Ss][Ee]	{ return (AUTO_RAISE); }
  [Ff][Oo][Rr][Cc][Ee][Ii][Cc][Oo][Nn][Ss]	{ return (FORCE_ICON); }
+ [Dd][Ww][Ii][Mm]_*[Ss][Ee][Tt]	{return (DWIM_SET); }
  [Dd][Ee][Ff][Aa][Uu][Ll][Tt][Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn] {
  			       return (DEFAULT_FUNCTION); }
  [Ww][Ii][Nn][Dd][Oo][Ww][Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn] {
diff -c twm/menus.c dwim/menus.c
*** twm/menus.c	Fri Dec  2 10:02:52 1988
--- dwim/menus.c	Fri Jun 23 16:00:11 1989
***************
*** 33,38 ****
--- 33,40 ----
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  #ifndef lint
  static char RCSinfo[] =
  "$Header: menus.c,v 1.2 88/10/18 11:36:25 jim Exp $";
***************
*** 1069,1077 ****
--- 1071,1085 ----
  	XFlush(dpy);
  	break;
  
+     case F_DWIMCOM:
+ 	dwim_command();
+ 	break;
+ 
      case F_QUIT:
  	Done();
  	break;
+     default:
+ 	printf("TRACER [ExecuteFunction]: unknown func %d\n",func);
      }
      XUngrabPointer(dpy, CurrentTime);
  }
diff -c twm/parse.c dwim/parse.c
*** twm/parse.c	Fri Oct 14 19:42:01 1988
--- dwim/parse.c	Thu Jun 22 19:17:03 1989
***************
*** 27,38 ****
   *
   * $Header: parse.c,v 1.16 88/07/19 13:49:08 toml Exp $
   *
!  * parse the .twmrc file
   *
   * 17-Nov-87 Thomas E. LaStrange		File created
   *
   ***********************************************************************/
  
  #ifndef lint
  static char RCSinfo[]=
  "$Header: parse.c,v 1.16 88/07/19 13:49:08 toml Exp $";
--- 27,40 ----
   *
   * $Header: parse.c,v 1.16 88/07/19 13:49:08 toml Exp $
   *
!  * parse the .dwimrc file
   *
   * 17-Nov-87 Thomas E. LaStrange		File created
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  #ifndef lint
  static char RCSinfo[]=
  "$Header: parse.c,v 1.16 88/07/19 13:49:08 toml Exp $";
***************
*** 54,63 ****
  /***********************************************************************
   *
   *  Procedure:
!  *	ParseTwmrc - parse the .twmrc file
   *
   *  Inputs:
!  *	filename  - the filename to parse.  A NULL indicates $HOME/.twmrc
   *
   ***********************************************************************
   */
--- 56,65 ----
  /***********************************************************************
   *
   *  Procedure:
!  *	ParseTwmrc - parse the .dwimrc file
   *
   *  Inputs:
!  *	filename  - the filename to parse.  A NULL indicates $HOME/.dwimrc
   *
   ***********************************************************************
   */
***************
*** 75,81 ****
      {
  	home = (char *)getenv("HOME");
  	strcpy(init_file, home);
! 	strcat(init_file, "/.twmrc");
      }
      else
  	strcpy(init_file, filename);
--- 77,83 ----
      {
  	home = (char *)getenv("HOME");
  	strcpy(init_file, home);
! 	strcat(init_file, "/.dwimrc");
      }
      else
  	strcpy(init_file, filename);
diff -c twm/twm.h dwim/twm.h
*** twm/twm.h	Fri Oct 14 19:42:33 1988
--- dwim/twm.h	Thu Jun 22 18:22:30 1989
***************
*** 33,38 ****
--- 33,40 ----
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  #ifndef _TWM_
  #define _TWM_
  
***************
*** 285,289 ****
--- 287,293 ----
  extern void Done();
  extern void Error();
  extern void Other();
+ 
+ extern int dwim_set;
  
  #endif _TWM_
diff -c twm/version.c dwim/version.c
*** twm/version.c	Tue Oct 18 11:36:52 1988
--- dwim/version.c	Fri Jun 23 19:28:46 1989
***************
*** 33,45 ****
   *
   ***********************************************************************/
  
  static char RCSinfo[]=
  "$Header: version.c,v 1.2 88/10/18 11:36:29 jim Exp $";
  
! char *Revision = "$Revision: 1.2 $";
! char *Date = "$Date: 88/10/18 11:36:29 $";
  
  /* the following strings are for the SCCS "what" command */
  
! char *WhatRevision = "@(#)twm $Revision: 1.2 $";
! char *WhatDate = "@(#)twm $Date: 88/10/18 11:36:29 $";
--- 33,47 ----
   *
   ***********************************************************************/
  
+ /* DWIM modifications David Rabson 6/89 */
+ 
  static char RCSinfo[]=
  "$Header: version.c,v 1.2 88/10/18 11:36:29 jim Exp $";
  
! char *Revision = "$Revision: 1.2d $";
! char *Date = "$Date: 88/10/18 11:36:29 dwim 6/89 $";
  
  /* the following strings are for the SCCS "what" command */
  
! char *WhatRevision = "@(#)twm $Revision: 1.2d $";
! char *WhatDate = "@(#)twm $Date: 88/10/18 dwim 6/89 $";