[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: window-update-cursor

At  9:07 AM 7/22/93 -0400, JIQIAN PAN wrote:
>I am trying to simulate a cursor with any size by using the generic 
>function WINDOW-UPDATE-CURSOR, but the result is unsatisfactory,
>that is, flicker, even though a double-buffer way has been used.
>I checked the MCL manual "The generic function WINDOW-UPDATE-CURSOR
>is called by UPDATE-CURSOR that is called periodically by the global
>event-handling system."  I am wondering how the event-handling system
>calls the function periodically, one third second or others.
>By the way, do you know other ways to do that?  Thanks.

The normal Macintosh cursor is updated at interrupt level, probably
every time the mouse moves. MCL calls WINDOW-UPDATE-CURSOR a maximum
of 60 times a second when the Listener is idle, though this depends on
the value of *idle-sleep-ticks*. When some computation is happenning,
it will call it according to *foreground-event-ticks*
(or *background-event-ticks*). Here are the default settings
for the relevant variables:

? *foreground-sleep-ticks*
? *background-sleep-ticks*
? *idle-sleep-ticks*
? *foreground-event-ticks*
? *background-event-ticks*

Read the manual about these variables for details, but I'd suggest
setting *idle-sleep-ticks* to 0 or 1 first. This should make your 
cursor update often enough while MCL is idle. When code is running,
the update period is controlled by *foreground-sleep-ticks*. You
can make this smaller, but the problem you'll run into is that MCL
will then spend a larger portion of its time processing events and
less of its time doing the foreground computation (e.g. compilation
will slow down). The only way I can think of to fix that problem is
with an interrupt routine (written in C, Pascal, or assembler) that
checks for the mouse having moved and does some magic that will cause
MCL's event processing to happen. I believe I know what that magic is,
but getting it right might take me a couple of hours, time that I really
don't have to spend. Can you live with a jerky cursor when MCL is
not idle?