Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!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: <9427@hoptoad.uucp> Date: 29 Dec 89 21:10:41 GMT References: <694@nems.dt.navy.mil> <33392@ucbvax.BERKELEY.EDU> <9421@hoptoad.uucp> <3506@husc6.harvard.edu> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 30 In article <3506@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes: > If you wanted to get *really* skanky, you could bottleneck _PostEvent, >and set a global flag subject to whether the event was for a fan-period. >This involves saving the application's A5 in a safe place, since _PostEvent >can get called at interrupt time, and you will probably need to test KeyMap >to look for the Command key... I pointed out the problem with this in the article you quoted. If you are giving time to other applications, then the PostEvent call at interrupt time may get called in another application's context, bypassing your application-specific patch. Due to the way the Event Manager works, you will still get the keyboard event, but PostEvent may not be called in your application context. So you can drop Command-Dots with this method too. If all applications get equal time, then the probability of correctly intercepting a Cmd-Dot is the reciprocal of the number of applications running. > Then in whatever operation you'd want to check, just test your global >flag each time through the loop, or at selective points during the computation. >It's pretty cheap to do all of this, and can be used in places where you >don't want to slow down by calling _GetNextEvent or _GetOSEvent... As long as you're not giving time to other applications, meaning you're not calling SystemTask, GetNextEvent, or WaitNextEvent, it should work. Otherwise not. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com If you vote for clowns, you have no right to complain that only clowns make it to the ballot.