nazgul@alphalpha.com (Kee Hinckley) (11/08/90)
I recently started unmapping/mapping windows instead of recreating them from scratch. However I've run into a rather strange bug dealing with keyboard focus. I'm running Motif 1.1, with a 1.0 Mwm (sorry, but that's what the customers are going to have). I have a main window and, upon pressing an accelerator I create another main window. When the user closes this (usually with an accelerator as well) I unmap the window and window manager returns focus to the first window. Now however none of the keyboard controls work in that window. I can still click the mouse, and I can type in text areas, but I can't use any of the arrow keys, mnemonics or acclerators. The problem remains this way until I go to the menubar and pulldown a menu (I don't have to select anything, just pull it down and release it). Presumbably someone is not resetting the focus quite right, and selecting a menu pulldown makes it happen explicitly. Now let's say I hit that accelerator again. Boom, I map the second window and there we are - in exactly the same state. No translations available. Again, pulling down a menu will correct the problem. That all happens quite consistantly the first time. From then on however, it's a tad more flakey. Sometimes everything seems to work, sometimes it doesn't, I haven't been able to pin down the circumstances. But, as I say, it's quite reliable the first time. I'm not so much concerned with why this happens (although I'll happily accept a patch to fix it) as how to work around it. It seems like there is probably some simple call I can make to forcibly make things work. Will XmProcessTraversal get around this? And of course, is this a known bug, or should I submit a bug report on it? -kee