Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!ux1.lbl.gov!beard From: beard@ux1.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: best way to detect command-. interrupt? Message-ID: <4539@helios.ee.lbl.gov> Date: 29 Dec 89 08:50:28 GMT References: <694@nems.dt.navy.mil> <33392@ucbvax.BERKELEY.EDU> <9421@hoptoad.uucp> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux1.lbl.gov (Patrick C Beard) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 34 X-Local-Date: 29 Dec 89 00:50:28 PST In article <9421@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >In article <694@nems.dt.navy.mil> science@nems.dt.navy.mil (Mark Zimmermann) >writes: >>>What is the 'officially approved' way to sense a command-period >>>(cmd-.) so that a user can interrupt a long operation from the keyboard? ... [discussion of various ways that degrade performance] ... > >I'm not really sure that there is any good way, short of patching the >keyboard driver -- and even that would be an application-specific >patch, so if you *are* giving other applications time, it could fail to >be invoked when the actual keypress happens. I suppose you could insert >a front-end to the driver into the unit table, but that seems like a >big mess for such a small operation. 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. 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. ------------------------------------------------------------------------------- - Patrick Beard, Macintosh Programmer (beard@lbl.gov) - - Berkeley Systems, Inc. "..............Good day!" - Paul Harvey - -------------------------------------------------------------------------------