<> <> <> <> 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.>> <> 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.>> <> 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: REF _ NIL] 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]; <> IdleReason: TYPE = {becomingIdle, becomingBusy}; < the terminal is about to be made idle. The swat watcher has NOT been turned off yet, but is about to be made so.>> < 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; <> <<>> END.