Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: best way to detect command-. interrupt? Message-ID: <9428@hoptoad.uucp> Date: 29 Dec 89 21:15:31 GMT References: <694@nems.dt.navy.mil> <33392@ucbvax.BERKELEY.EDU> <9421@hoptoad.uucp> <4539@helios.ee.lbl.gov> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 28 In article <4539@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes: >How about a patch to PostEvent? That way, when the keypress occurs the >patch can set an application global to take note of it, and all that is >required in the inner loop of the application is polling that global variable. >This provides both the friendliness and the performance. See message to Rich. I already dealt with this issue in the message you quoted, and in addition, I've dealt with it in some of the trap patching messages last month. Guess you both missed those messages. >Another point, events such as keypresses and mouse clicks are only delivered >to the application in the front layer in MultiFinder. Therefore, the >application applied patch to PostEvent would only see cmd-. if that >application is in front. MultiFinder, as well, unpatches application >applied patches when context switching so you wouldn't interrupt the >application if you happened to be in another layer. Again, PostEvent is not the *delivery* routine. It simply puts the events in the global queue. The frontmost-only delivery is done by the Toolbox Event Manager (GetNextEvent, EventAvail, WaitNextEvent), not by the OS Event Manager (PostEvent, OSEventAvail, GetOSEvent). PostEvent is called when there is a device interrupt whatever the context may happen to be at the time. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Prisons are built with stones of Law, Brothels with bricks of Religion." - Blake, "The Marriage of Heaven and Hell"