[comp.windows.x] twm seems to interfere with xterm

tjd@leghorn.mpd.tandem.com (Tom Davidson) (09/28/89)

Ok, so this has been asked before, I didn't have the problem so I ignored
the answer.  But now I do...

I'm trying to run xterm when using twm.  As soon as twm gets going and
reparents the xterm, keypresses don't make it to xterm anymore.  Button
presses (ctl mouse 1 etc) all work fine.  Mouse movements cause the
appropriate focus change, the title bar icons work, just no characters
that are typed make their way to xterm.

This doesn't happen on a sun client-server mix, but I have seen it happen
in the past when the server was R2 and the client R3.  We are trying
to run X terminals (R2 and R3) with R3 clients (on SunOs3 & 4).

Please help!  I have begun to debug the problem, but would really rather
get back to what I was doing.  Sooo, if anymore knows the magic answer,
please post it.

Thanks in advance... Tom

---
Tom Davidson			internet: halley!foghorn!tjd@cs.utexas.edu 
Tandem Computers, Inc.		fax: (512) 244-8247 voice: (512) 244-8375
14231 Tandem Boulevard
Austin, TX 78728-6610

dave@fps.com (Dave Smith) (10/03/89)

In article <595@halley.UUCP> halley!tjd@cs.utexas.edu writes:
>I'm trying to run xterm when using twm.  As soon as twm gets going and
>reparents the xterm, keypresses don't make it to xterm anymore.  Button
>presses (ctl mouse 1 etc) all work fine.  Mouse movements cause the
>appropriate focus change, the title bar icons work, just no characters
>that are typed make their way to xterm.
>

This sounds as if you have function keys defined in your .twmrc (eg the Sun
L5 for expose, L7 for close) which do not exist on your X terminal.  Get rid
of the definitions for these (or change them to F keys) in the .twmrc and
try it.


David L. Smith
FPS Computing, San Diego
ucsd!celerity!dave or dave@fps.com
"Repent, Harlequin!," said the TickTock Man

andrews@sdipl.oz (Andrew Schonberger) (10/06/89)

In article <1124@celit.fps.com> dave@fps.com (Dave Smith) writes:
 >In article <595@halley.UUCP> halley!tjd@cs.utexas.edu writes:
 > >I'm trying to run xterm when using twm.  As soon as twm gets going and
 > >reparents the xterm, keypresses don't make it to xterm anymore.  Button
 > >presses (ctl mouse 1 etc) all work fine.  Mouse movements cause the
 > >appropriate focus change, the title bar icons work, just no characters
 > >that are typed make their way to xterm.

That's exactly what happens on my machine. I suspect some version mismatch,
or out of date software. I'm runnig X11.R2 on an Apollo DN3500. My 'twm' is
from the uunet archive (presumably R3), but I did not apply the patches yet.
 
 >This sounds as if you have function keys defined in your .twmrc (eg the Sun
 >L5 for expose, L7 for close) which do not exist on your X terminal.  Get rid
 >of the definitions for these (or change them to F keys) in the .twmrc and
 >try it.

I tried it but did not help. When given acces to a stderr, twm told me:
         twm: unknown key name "ClearLine"
There is really no such key on my terminal, so I deleted any reference
to ClearLine from .twmrc. It still doesn't work, even after focus/defocus.

Besides making xterm deaf and blind, my twm dies by 'Segmentation error'
when I want to deiconify some windows, or bring up a new one. When I move
a window, the new position is not repainted properly. 

Is there a patched twm available on some archive ? 
Did anyone run twm succesfully with R2 ?

Andrew Schonberger      INTERNET: andrews@sdipl.sdi.oz.au
                           UUNET: uunet!munnari!sdipl.sdi.oz.au!andrews
-opinions are mine only-  ACSNET: andrews@sdipl.sdi.oz

tjd@leghorn.mpd.tandem.com (Tom Davidson) (10/10/89)

> 
>  > >I'm trying to run xterm when using twm.  As soon as twm gets going and
>  > >reparents the xterm, keypresses don't make it to xterm anymore.  Button
>  > >presses (ctl mouse 1 etc) all work fine.  Mouse movements cause the
>  > >appropriate focus change, the title bar icons work, just no characters
>  > >that are typed make their way to xterm.
> 
> That's exactly what happens on my machine. I suspect some version mismatch,
> or out of date software. I'm runnig X11.R2 on an Apollo DN3500. My 'twm' is
> from the uunet archive (presumably R3), but I did not apply the patches yet.
>  
>  >This sounds as if you have function keys defined in your .twmrc (eg the Sun
>  >L5 for expose, L7 for close) which do not exist on your X terminal. 
Get rid
>  >of the definitions for these (or change them to F keys) in the .twmrc and
>  >try it.
> 
>          twm: unknown key name "ClearLine"
> There is really no such key on my terminal, so I deleted any reference
> to ClearLine from .twmrc. It still doesn't work, even after focus/defocus.
> 
> Besides making xterm deaf and blind, my twm dies by 'Segmentation error'
> when I want to deiconify some windows, or bring up a new one. When I move
> a window, the new position is not repainted properly. 
> 
> Is there a patched twm available on some archive ? 

Ok, here's what I found.

When I removed definitions for unknown keys, everything was forgiven and
twm & xterm ceased their squabble over the keyboard. Good boys.

I suspect that your source may have become corrupted resulting in the
segmentation errors as I have never seen twm crash; R2 or R3.

I received a patch for the unknown keys problem, but although it works,
I'm unhappy that it complains about unknown keys. This makes it ugly
to build a single .twmrc file for multiple machines. (oh no, a .twmrc-ipaddr
file???).  Not compliaining would be misleading in the simple sense.

patch enclosed...

#! /bin/sh
# 1.  Remove everything above the #! /bin/sh line.
# 2.  Save the resulting test in a file
#
#key.patch
#orphans.patch
#
# Created by toml () on Fri Jul 14 10:58:58 MDT 1989
#
if test -f 'key.patch'
then
    echo shar: will not over-write existing file "key.patch"
else
echo extracting "key.patch"
sed 's/^X//' >key.patch <<'SHAR_EOF'
X*** orig/menus.c       Thu Apr 27 08:29:16 1989
X--- menus.c    Wed Jun  7 07:58:21 1989
X***************
X*** 137,147 ****
X  {
X      FuncKey *tmp;
X      KeySym keysym;
X
X!     if ((keysym = XStringToKeysym(name)) == NoSymbol)
X      {
X!      fprintf(stderr, "twm: unknown key name \"%s\"\n", name);
X!      return;
X      }
X
X      /* see if there already is a key defined for this context */
X--- 137,153 ----
X  {
X      FuncKey *tmp;
X      KeySym keysym;
X+     KeyCode keycode;
X
X!     /*
X!      * Don't let a 0 keycode go through, since that means AnyKey to the
X!      * XGrabKey call in GrabKeys().
X!      */
X!     if ((keysym = XStringToKeysym(name)) == NoSymbol ||
X!         (keycode = XKeysymToKeycode(dpy, keysym)) == 0)
X      {
X!         fprintf(stderr, "twm: unknown key name \"%s\"\n", name);
X!         return;
X      }
X
X      /* see if there already is a key defined for this context */
SHAR_EOF
if test 879 -ne "`wc -c < key.patch`"
then
    echo shar: error transmitting "key.patch" '(should have been 879
characters)
'
fi
fi
if test -f 'orphans.patch'
then
    echo shar: will not over-write existing file "orphans.patch"
else
echo extracting "orphans.patch"
sed 's/^X//' >orphans.patch <<'SHAR_EOF'
Xdiff -c orig//add_window.c ./add_window.c
X*** orig//add_window.c Thu Apr 27 08:29:13 1989
X--- ./add_window.c     Thu Apr 27 08:32:16 1989
X***************
X*** 338,343 ****
X--- 338,360 ----
X      tmp_win->icon = FALSE;
X      tmp_win->icon_on = FALSE;
X
X+     XGrabServer(dpy);
X+
X+     /*
X+      * Make sure the client window still exists.  We don't want to leave an
X+      * orphan frame window if it doesn't.  Since we now have the server
X+      * grabbed, the window can't disappear later without having been
X+      * reparented, so we'll get a DestroyNotify for it.  We won't have
X+      * gotten one for anything up to here, however.
X+      */
X+     if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY,
X+                      &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0)
X+     {
X+         free((char *)tmp_win);
X+         XUngrabServer(dpy);
X+         return(NULL);
X+     }
X+
X      /* add the window into the twm list */
X      tmp_win->next = TwmRoot.next;
X      if (TwmRoot.next != NULL)
Xdiff -c orig//events.c ./events.c
X*** orig//events.c     Thu Apr 27 08:29:14 1989
X--- ./events.c Thu Apr 27 08:31:21 1989
X***************
X*** 656,661 ****
X--- 656,663 ----
X       }
X
X       tmp_win = AddWindow(w);
X+      if (tmp_win == NULL)
X+              return;
X       if (tmp_win->wmhints && (tmp_win->wmhints->flags & StateHint))
X       {
X           switch (tmp_win->wmhints->initial_state)
SHAR_EOF
if test 1363 -ne "`wc -c < orphans.patch`"
then
    echo shar: error transmitting "orphans.patch" '(should have been
1363 charac
ters)'
fi
fi
# end of shell archive
exit 0


Tom Davidson			internet: halley!foghorn!tjd@cs.utexas.edu 
Tandem Computers, Inc.		fax: (512) 244-8247 voice: (512) 244-8375
14231 Tandem Boulevard
Austin, TX 78728-6610