Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!samsung!uunet!kddlab!titcca!sragwa!sravd.sra.JUNET From: erik@sravd.sra.JUNET (Erik M. van der Poel) Newsgroups: comp.windows.x Subject: Re: keybord focus in libXaw Message-ID: <1284@sragwa.sra.JUNET> Date: 22 Nov 89 05:46:00 GMT References: <8911202222.20499@munnari.oz.au> <1283@sragwa.sra.JUNET> Sender: news@sragwa.sra.JUNET Reply-To: erik@sra.co.jp (Erik M. van der Poel) Organization: Software Research Associates, Inc., Japan Lines: 76 In article <1283@sragwa.sra.JUNET> I wrote: >In article <8911202222.20499@munnari.oz.au> munnari!arp.anu.OZ.AU!gustav@uunet.uu.net writes: >> However, >> when I try to close the window by pressing the "close window" command >> button, the window takes the keyboard focus with it, and it cannot be >> transferred to the main command panel, unless the pop-up window is popped >> up again. > >Here are a couple of work-arounds: > >1. NoTitleFocus > > ... > >2. X Toolkit > > ... And here are a few more solutions: 3. Focus events This is another disgusting hack which involves patching FocusOut events. Instead of XtMainLoop(), use: while (1) { static Window window; XEvent event; XtNextEvent(&event); switch (event.type) { case FocusIn: window = event.xfocus.window; break; case FocusOut: event.xfocus.window = window; break; default: break; } XtDispatchEvent(&event); } Advantage: This solution can be used if you plan to distribute your application in source form. (The Xt patch is for the binary form, and then only if you don't use dynamic linking.) Disadvantage: This may not work for everyone. (However, it does work for xfig.) 4. Destroy popup Destroying the popup instead of popping it down also solves the problem, as Rick Spickelmier said in an earlier article. Advantage: This solution, like the NoTitleFocus solution, does not seem to be "illegal" in any way. Disadvantage: You have to create the popup every time you need it, and this can be time-consuming, depending on the complexity of the popup. [5. Wait Wait until someone fixes the bug, rather than using work-arounds. Or fix it yourself. GOOD LUCK!]