ViewerIdleImpl:
CEDAR
MONITOR
IMPORTS Buttons, Idle, SystemVersion, ViewerOps
EXPORTS ViewerIdle
= {
GetIdleProc: PUBLIC ENTRY PROC RETURNS [proc: Buttons.ButtonProc, clientData: REF ANY] = {proc ← idleProc; clientData ← idleData};
SetIdleProc:
PUBLIC
ENTRY
PROC [proc: Buttons.ButtonProc, clientData:
REF
ANY ←
NIL]
RETURNS [oldProc: Buttons.ButtonProc, oldClientData:
REF
ANY] = {
oldProc ← idleProc;
oldClientData ← idleData;
idleProc ← proc;
idleData ← clientData;
};
idleProc: Buttons.ButtonProc ← CallSleep;
idleData: REF ANY ← NIL;
CallSleep: Buttons.ButtonProc = {Idle.Sleep[]};
IdleProc:
PROC [parent:
REF
ANY, clientData:
REF
ANY ←
NIL,
mouseButton: Menus.MouseButton ← red, shift, control:
BOOL ←
FALSE]
--Buttons.ButtonProc-- = {
idleProc[
parent: parent,
clientData: idleData,
mouseButton: mouseButton,
shift: shift,
control: control];
RefreshIfNecessary[];
};
useIdleCrock: BOOL ← TRUE; -- can be set to FALSE to provoke the bug
RefreshIfNecessary:
PROC = {
IF useIdleCrock
AND SystemVersion.machineType = dandelion
THEN
RRA: February 24, 1984 12:44:23 pm PST
This crock is here to get around a bug that is probably in VM. If we do not repaint everything, trash gets left on the screen after Idle comes back. This is tied up with the special memory used for the terminal on DLions, and nowhere else. Luckily, the bug appears benign except for the screen trash.
ViewerOps.PaintEverything[];
};
idleViewer: ViewerClasses.Viewer;
Start:
PROC = {
idleViewer ← Buttons.Create[info: [name: "Idle"], proc: IdleProc, fork: TRUE];
};
Start[];
}.