Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Tail patches Message-ID: <9028@hoptoad.uucp> Date: 20 Nov 89 18:37:23 GMT References: <1459@sequent.cs.qmc.ac.uk> <36250@apple.Apple.COM> <5056@internal.Apple.COM> <1989Nov7.212837.5146@oracle.com> <5080@internal.Apple.COM> <1467@sequent.cs.qmc.ac.uk> <46c51bee.129dc@blue.engin.umich.edu> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 46 In article <1467@sequent.cs.qmc.ac.uk> jeremyr@cs.qmc.ac.uk (Jeremy Roussak) writes: >I was challenged to write a patch which would play a sound, preferably >whenever the Finder emptied the wastebasket > >The obvious thing to do, (and we all do obvious things, don't we...) >was to do a tail patch on MenuSelect, look for a return of 0x00050002, >check that CurApName is the same as FinderName and to play the sound >if it is. This is probably one of those cases where a tail patch is an acceptable risk. MenuSelect is called in one context, when an application wants to track the menu bar. It's unlikely to be called from any other trap, only directly from the application, and so is very unlikely to acquire any come-from patches in the course of Apple bug fixes or extensions. Furthermore, if it *does* cause problems, it doesn't do anything vital, and the user can just throw it away. In article <46c51bee.129dc@blue.engin.umich.edu> mystone@caen.engin.umich.edu writes: > Install an event filter in jGNEFilter that looks for mouse ups. When you >get a mouse up, and CurApName is FinderName, look at MenuDisable. If it's >$00050002, then flush your toilet. (How's that for twisted?) Should work. Of course, using jGNEFilter goes against some other, more pressing compatibility guidelines, such as not writing to low-memory globals, since they'll go away in the future. > Or, even better (depending on how you look at it) yet, patch _CopyBits. >When the source and destionation rectangles are 32 by 32, do a bitwise compare >with the stuffed trash can. (Or whatever your new icon is that signifies >there's something in the trash.) If it's changing to the full state, set a >flag in your code. Next time _CopyBits is called with source and destination >rectangles of 32 by 32, and the bit map is the empty state of the trash >can, play your sound here, then go on to the old _CopyBits. My, how the mind >goes at 5:15 in the morning... Amusing, but remember how often the Finder draws icons. This kind of thing is not worth a performance hit of this magnitude. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "I have recently been examining all the known superstitions of the world, and do not find in our particular superstition (Christianity) one redeeming feature. They are all alike founded on fables and mythology." -- Thomas Jefferson