Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!ukma!tut.cis.ohio-state.edu!bloom-beacon!verdix.COM!nomad From: nomad@verdix.COM (Lee Damon) Newsgroups: comp.windows.x Subject: Re: twm on Sun 4 under SunOS4.0 Message-ID: <8812151954.AA22262@symmetry.verdix.com> Date: 15 Dec 88 19:54:32 GMT References: <8812151936.AA17858@ogccse.OGC.EDU> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 85 Return-Path: uunet!ginsu.apple.com!davep To: nomad@verdix.com Subject: Re: twm on Sun 4 under SunOS4.0 In-Reply-To: Your message of 06 Dec 88 22:14:45 +0000. <139@verdix.verdix.com> Date: Wed, 07 Dec 88 11:12:53 -0800 Try this patch, which I've previously posted. Note that your twm version number may be 1.2 instead of 4.0 or 5.0, since it uses the RCS version number and was checked in at MIT as 1.1, then 1.2. It's a problem with grabbing keys. It's still a problem in twm 5.0 (which is included on the R3 tape). In twm 4.0, Tom added the ability to bind functions to keys on the keyboard. The .twmrc file you're using probably references a key for which your server does not have a keycode. In the .twmrc file, you specify a key string name; this gets converted into a keysym, of which there are many, and gives an error if the keysym doesn't exist. The keysym then gets converted to an actual keycode, of which a much smaller number generally exist. There is no error checking here; if there is no corresponding keycode, a 0 is returned. This value is passed as the keycode to XGrabKey, but 0 means AnyKey to XGrabKey, so it grabs all keys. Here's a patch for this problem. The line numbers match twm 5.0, but it succeeds in patching twm 4.0 also. *** /tmp/,RCSt1a00790 Wed Nov 9 01:20:05 1988 - - --- menus.c Wed Nov 9 01:20:11 1988 *************** *** 137,144 **** { FuncKey *tmp; KeySym keysym; ! if ((keysym = XStringToKeysym(name)) == NoSymbol) { fprintf(stderr, "twm: unknown key name \"%s\"\n", name); return; - - --- 137,150 ---- { FuncKey *tmp; KeySym keysym; + KeyCode keycode; ! /* ! * Don't let a 0 keycode go through, since that means AnyKey to the ! * XGrabKey call in GrabKeys(). ! */ ! if ((keysym = XStringToKeysym(name)) == NoSymbol || ! (keycode = XKeysymToKeycode(dpy, keysym)) == 0) { fprintf(stderr, "twm: unknown key name \"%s\"\n", name); return; *************** *** 162,168 **** tmp->name = name; tmp->keysym = keysym; ! tmp->keycode = XKeysymToKeycode(dpy, keysym); tmp->cont = cont; tmp->mods = mods; tmp->func = func; - - --- 168,174 ---- tmp->name = name; tmp->keysym = keysym; ! tmp->keycode = keycode; tmp->cont = cont; tmp->mods = mods; tmp->func = func; - - -- Dave Payne Apple Computer, A/UX Engineering Group davep@apple.com (408) 974-5545 --------------------- Lee Damon UUCP: verdix!------- UUCP: verdix!nomad \ \ Internet: nomad@verdix.com {tektronix,hp-pcd}!orstcs!castle!nomad FidoNet: 105/302 - The Castle BBS - 503-629-5841 / agora! "Say what you like, the bicycle has a great past ahead of it!"