|
Wherein arcane mysteries are unraveled so you can make the Alarm Clock (or a
similar desk accessory) blink the Apple menu at the appointed second. Also, why
GetNextEvent is a good thing.
[Mar 01 1988]
|
The obvious
Don't disable interrupts within an application! There will almost certainly
come a time (or Macintosh) where you won't be able to change the interrupt mask
because the processor is running in user mode. The one-second interrupt is used
to blink the apple.
Back to top
The not-so-obvious
You must call GetNextEvent periodically. GetNextEvent uses a
filter (GNE filter) which allows for a routine to be installed that overrides
(or augments) the behavior of the system. The GNE filter is installed by
pointing the low-memory global jGNEFilter (a long word at
$29A ) to the routine. After all other GNE processing is complete, the
routine will be called with A1 pointing to the event record
and D0 containing the boolean result. The filter may then modify the
event record or change the function result by altering the word on the stack at
4(A7) . This word will match D0 initially, of course.
A GNE filter is used to do the blinking when the interrupt handler has
announced that the moment is at hand. GetOSEvent won't do. If you
don't have a standard main event loop, it is generally a good idea to give
GetNextEvent (and SystemTask , too) a call whenever you have
any idle time. GetNextEvent "extra" services include, but aren't
limited to, the following:
- Calling the GNE filter.
- Removing lingering disk-switched windows (uncommon unless memory is tight).
- Making Window Manager activate, deactivate and update events happen.
- Getting various events from a journaling driver when one is playing.
- Giving
SystemEvent a chance at each event.
- Running command-shift function key routines (e.g., Command-Shift-4 to print the screen to an ImageWriter).
Back to top
The more subtle
When the (default) GNE filter sees that the interrupt handler has set the "time
to blink" flag, it looks at the first menu in MenuList . The title of
that menu must consist solely of the "Apple" character or no blinking will
occur. It really just looks at the first word of the string to see if it is
$0114 . This is a Pascal string which has only the $14 "apple"
character in it. So you musn't have any spaces or any other characters in the
title of your first menu or you'll get no blinkin' results.
Back to top References
The Menu Manager
The Toolbox Event Manager
The Desk Manager
Back to top
Downloadables
|
Acrobat version of this Note (48K).
|
Download
|
|