Idle.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Levin on December 12, 1983 3:09 pm
Russ Atkinson (RRA) February 5, 1985 3:55:26 pm PST
DIRECTORY BasicTime USING [GMT, nullGMT];
Idle: CEDAR DEFINITIONS = BEGIN OPEN BasicTime;
Sleep: PROC [proc: ImageProc ← DefaultImageProc, powerOff: GMT ← nullGMT];
... puts the user interface into an idle state. The normal display screen is replaced by a black one with a roving, client-selected image. Control-shift-shift (to change virtual terminals) and key combinations that invoke a debugger are disabled. When a key is pressed, the black screen disappears and the user is asked to log in. If the login fails, the terminal reverts to the quiescent state; if the login succeeds, Sleep returns to its caller after restoring the terminal to its state at the time of invocation.
`proc' provides the roving image. It is invoked every time Sleep chooses to change the coordinate position, which varies randomly between 0.25 and 2.0 seconds.
The 'powerOff' parameter, unless defaulted, specifies the time at which the processor is to be powered off.
ImageProc: TYPE = PROC [w, h: CARDINAL] RETURNS [BitmapRef];
... defines a rectangle of the display bitmap that is available to hold an image. An ImageProc should generally return a BitmapRef with width <= w and height <= h; however, if these conditions are not met, Sleep will clip the bitmap as necessary. Note that the contents and dimensions of the bitmap may change from call to call of an ImageProc. The bits of the bitmap are inverted in the course of painting; that is, zeroes paint as black (to match the background) and ones paint as white.
Note that the following two types are structurally identical to the ones in GraphicsOps.
BitmapRef: TYPE = REF READONLY BitmapRep;
BitmapRep: TYPE = RECORD [
base: REF, -- pointer to bitmap bits
raster: CARDINAL, -- words per line (note: words, not bits)
width: CARDINAL, -- width in bits
height: CARDINAL -- height in lines
];
DefaultImageProc: ImageProc;
IsIdle: PROC RETURNS [BOOL];
... returns TRUE iff the machine has entered the idle state.
RegisterIdleHandler: PROC [handler: IdleHandler, data: REFNIL] RETURNS [IdleRegistration];
... registers an idle handler to be called when the terminal is either about to become idle or about to become busy after being idle. The callback data will be passed on to the handler. The user should not rely on the order of handlers called.
UnregisterIdleHandler: PROC [registration: IdleRegistration];
... unregisters the idle handler. The registration given must have resulted from RegisterIdleHandler. If the given registration is no longer valid, this procedure call will be ignored.
IdleHandler: TYPE = PROC [data: REF, reason: IdleReason];
The type of the handler. The data is as given to RegisterIdleHandler, and the reason is explained below. If the reason is becomingIdle, then the machine is not yet idle when the procedure is called. If the reason is becomingBusy, then the machine is still idle when the procedure is called.
IdleReason: TYPE = {becomingIdle, becomingBusy};
becomingIdle => the terminal is about to be made idle. The swat watcher has NOT been turned off yet, but is about to be made so.
becomingBusy => the terminal is about to be made not idle. The swat watcher has been turned on again. Also, the user has logged in, and if there are procedures to be run when the profile changes then they have been run.
IdleRegistration: TYPE = REF;
Really this is just a unique key to identify registrants.
END.