Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!bionet!agate!jwgibbs!pete From: pete@jwgibbs.cchem (Pete Goodeve) Newsgroups: comp.windows.x Subject: Setting input focus to terminal window Message-ID: <1991Mar22.044157.25789@agate.berkeley.edu> Date: 22 Mar 91 04:41:57 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: University of California, Berkeley Lines: 33 Originator: pete@jwgibbs There's something I'm missing regarding the management of keyboard focus in the presence of a manager. I have a program in which I want to switch focus back to the terminal window from which the program is running (away from the work window the program itself has created) so that the user can type in some new parameters; the switch is triggered by some event in the main window (mouse-click or key-press). (...Okay, I know that the "proper" way to do it would be to pop up a dialog window using one of the toolkits, but this program is a conversion from an old X10 one, and I'm trying to keep it as close as I can to the original for now.) My expectation was that I could do XGetInputFocus BEFORE I opened any window from the program, and acquire the ID of the terminal window, as that must surely be the one with the current focus, no? Then, when the program wanted K/B input, it would simply issue XSetInputFocus to that window until input was complete. Well, I get a window ID alright, but trying to change the focus to it has absolutely no effect! Also the ID I get doesn't seem to be that of the terminal window itself, but rather its window-manager-decorated parent! So what's up? I should say that I'm doing most of my work on an IBM RISC/320 running mwm and aixterm, but i seem to get similar effects on the DEC 5000 the program will normally be at home on. (I'm only mildly interested in portability...!) Are there any ways to achieve my intention besides the one I've tried? (I should also add that I have no trouble setting the focus to my own window. mwm by default seems to do that automatically -- even for windows that I don't WANT to send input to -- so I set the XWMHints.input field False, and do XSetInputFocus myself. That works fine.) Any pointers appreciated. --Pete --