Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: mouse@larry.mcrcim.mcgill.EDU Newsgroups: comp.windows.x Subject: Re: ICCCM question on InputFocus Message-ID: <9101060712.AA19844@Larry.McRCIM.McGill.EDU> Date: 6 Jan 91 07:12:02 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 29 >>> I have an application with multiple documents, and I need some way >>> of determining which document is "current". Users make documents >>> current by clicking on them on the Mac. The X equivalent seems to >>> be FocusIn events, >> Depending on precisely what you want, the equivalent is either >> ButtonPress or FocusIn. If you want to choose among multiple >> top-level windows, I would recommend FocusIn. > I don't think that that's sufficient. Epoch faces this problem also, > and in order for things to work (mostly) right, it is necessary to > track both focus events and window transition events. Yes, you are of course correct. I apologize; I should have thought about it before posting. I even know this; when writing mterm's code to determine whether it has keyboard focus I had to go to some length to get it right. (I think it is sufficient to track FocusChangeMask, EnterWindowMask, and LeaveWindowMask on your top-level window and FocusChangeMask on the root of the screen you're on. The decision of what to do on each event received requires a couple of state variables, but I *think* I have it working. The table describing what actions to take in what circumstances is long enough that I'm reluctant to include it here; anyone who wants a copy can send me mail, and in the unlikely event that I get a great flood of requests, I'll post it. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu