DIRECTORY Buttons USING [ButtonProc, Create], CedarInitOps USING [Sleep], CedarSnapshot USING [CheckpointProc, Register, RollbackProc], ClassIncreek USING [ActionBody, GetAction, Increek, IncreekError, NewStdIncreek, SetAtLatest], Cursors USING [CursorType, GetCursor, SetCursor], Interminal USING [KeyState], Process USING [Abort, Detach, Pause, priorityForeground, Seconds, SecondsToTicks, SetPriority], UserProfile USING [Number], UserTerminal USING [keyboard], ViewerOps USING [EnumerateViewers, EnumProc, PaintViewer, SaveAllEdits]; ViewerProcesses: CEDAR MONITOR IMPORTS Buttons, CedarSnapshot, CedarInitOps, ClassIncreek, Cursors, Process, UserProfile, UserTerminal, ViewerOps = BEGIN EmergencySaveAllEdits: PROC = TRUSTED BEGIN keys: LONG POINTER TO Interminal.KeyState = LOOPHOLE[UserTerminal.keyboard]; oldCursor: Cursors.CursorType _ Cursors.GetCursor[]; PaintCaption: ViewerOps.EnumProc = TRUSTED BEGIN ViewerOps.PaintViewer[v, caption]; END; Process.SetPriority[Process.priorityForeground]; DO -- forever Process.Pause[Process.SecondsToTicks[1]]; IF --keys.bits[Lock]=down AND-- keys.bits[LeftShift]=down AND keys.bits[RightShift]=down AND keys.bits[Spare3]=down THEN BEGIN Cursors.SetCursor[activate]; ViewerOps.SaveAllEdits[]; Cursors.SetCursor[oldCursor]; ViewerOps.EnumerateViewers[PaintCaption]; -- ok if this doesn't finish END; ENDLOOP; END; idleProcess: PROCESS _ NIL; AutoIdle: PROC = TRUSTED BEGIN ENABLE ANY => GOTO Punt; -- punt if bad number or ABORTED increek: ClassIncreek.Increek; action: ClassIncreek.ActionBody; idleTime: Process.Seconds; idleTime _ 60 * UserProfile.Number["AutoIdleTimeout", 20]; IF idleTime<=0 THEN RETURN; increek _ ClassIncreek.NewStdIncreek[]; DO -- forever ClassIncreek.SetAtLatest[increek]; Process.Pause[Process.SecondsToTicks[idleTime]]; action _ ClassIncreek.GetAction[increek, dontWait, ----, clicksAndMotion ! ClassIncreek.IncreekError => LOOP]; WITH a: action SELECT FROM timedOut => CedarInitOps.Sleep[]; -- idle ENDCASE; ENDLOOP; EXITS Punt => NULL; END; IdleOn: CedarSnapshot.RollbackProc = BEGIN idleProcess _ FORK AutoIdle[]; END; IdleOff: CedarSnapshot.CheckpointProc = TRUSTED BEGIN Process.Abort[idleProcess]; JOIN idleProcess; idleProcess _ NIL; END; IdleProc: Buttons.ButtonProc = TRUSTED {CedarInitOps.Sleep[]}; [] _ Buttons.Create[info: [name: "Idle"], proc: IdleProc, fork: TRUE, documentation: "Hide desktop pending user login"]; TRUSTED {Process.Detach[FORK EmergencySaveAllEdits[]]}; TRUSTED {CedarSnapshot.Register[IdleOff, IdleOn]; IdleOn[rollback]}; END. ”ViewerProcesses.mesa; written by S. McGregor Edited by McGregor on May 23, 1983 12:55 pm Last Edited by: Maxwell, January 21, 1983 8:56 am Κ– "Mesa" style˜JšΟc-™-Jš+™+J™1J™šΟk ˜ Jšœžœ˜#Jšœ žœ ˜Jšœžœ*˜=Jšœ žœL˜^Jšœžœ$˜1Jšœ žœ ˜JšœžœR˜_Jšœ žœ ˜Jšœ žœ ˜Jšœ žœ9˜HJ˜—Jšœžœž˜J˜Jšžœm˜tJ˜Jšž˜J˜šΟnœžœžœž˜+Jš œžœžœžœžœ˜LJšœ4˜4šœ#žœž˜0Jšœ"˜"Jšžœ˜—Jšœ0˜0šžœ ˜ J˜)š žœœžœžœžœž˜~Jšœ˜Jšœ˜Jšœ˜Jšœ*˜FJšžœ˜—Jšžœ˜—Jšžœ˜—J˜Jšœ žœžœ˜J˜šŸœžœžœž˜JšžœžœžœΠck˜9J˜J˜ J˜J˜:Jšžœ žœžœ˜J˜'šžœ ˜ J˜"J˜0šœ3œ˜HJšœžœ˜%—šžœ žœž˜Jšœ"˜)Jšžœ˜—Jšžœ˜—Jšžœ žœ˜Jšžœ˜J˜—šœ%žœ˜+Jšœžœ ˜Jšžœ˜—J˜šœ(žœž˜5J˜Jšžœ ˜Jšœžœ˜Jšžœ˜J˜—Jšœžœ˜>J˜šœ@žœ˜EJ˜2—J˜Jšžœžœ˜7J˜Jšžœ>˜EJšžœ˜J˜J˜—…— ψ Ž