[net.micro.mac] Automatically Displaying the Watch Cursor

lsr@apple.UUCP (Larry Rosenstein) (01/18/86)

In article <3131@sdcc3.UUCP> borton@sdcc3.UUCP (Chris Borton) writes:
>Now, this paragraph is a plea to Apple and all other developers to take the 
>little time and effort necessary to change the cursor to the watch when the 
>program is working.

On the Macintosh, the program must explicitly change the cursor to a watch
when it thinks that the operation is going to take a long time.  This is
sometimes hard to do.  On the old Lisa O/S this was automatic; if the
program 'was busy' (definition below) for a certain length of time, then
hourglass automatically appeared, and the original cursor was restored when
the program became 'unbusy'.

In MacApp we implemented a similar automatic scheme, which relieves the
programmer of thinking about handling the watch at all, and gives users the
correct busy cursor feedback all the time.

We define a busy program as one that does not call either of the traps
GetNextEvent or EventAvail for a certain period of time.  (For discussion,
let's say 4 seconds.)  If a program is not calling one of these traps, then
it is not prepared to respond to user events, and therefore is busy.

The method we use is very simple.  We setup a vertical retrace task that
triggers in 4 seconds, and changes the cursor to the watch (if it is not
already a watch).  We also override the GetNextEvent and EventAvail traps,
and run the original code after:
  1) resetting the vertical retrace timer (to 4 seconds in this example)
  2) restoring the original cursor (if it was changed to a watch)

When we change to the watch cursor, we stash the old cursor, which is found
in a low memory global.  Since the watch is put up during a vertical
retrace interrupt, we have to preload the cursor and make it non-purgeable.

For completeness, we have ways for the programmer to force the watch cursor
to appear/disappear immediately and inhibit this feature entirely.  These
things are not used in most applications.

Right now the source code for this is integrated into MacApp, but I plan on
separating it into its own module.  When I get around to doing this, I will
be able to post the actual source code.

Let me know if you have comments or questions.

-- 
Larry Rosenstein
Apple Computer

UUCP:  {voder, nsc, ios, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.CSNET

gus@Shasta.ARPA (01/20/86)

Some time ago, a program was posted, AutoCursor, which did just about the
same thing that Larry Rosenstein discussed in an earlier posting. I will re-
post this little utility in net.sources.mac.

                                                        Gus Fernandez