DIRECTORY Buttons USING [ButtonProc, Create], ClassIncreek USING [ActionBody, GetAction, Increek, IncreekError, NewStdIncreek, SetAtLatest], EndOps USING [], Idle USING [IsIdle, Sleep], Process USING [Detach, DisableTimeout, GetCurrent, SecondsToTicks, SetTimeout], RuntimeError USING [UNCAUGHT], SystemVersion USING [machineType], UserProfile USING [CallWhenProfileChanges, Number, ProfileChangedProc], ViewerClasses USING [Viewer], ViewerOps USING [PaintEverything], ViewerPrivate USING []; EndOpsImpl: CEDAR MONITOR IMPORTS Buttons, ClassIncreek, Process, Idle, RuntimeError, SystemVersion, UserProfile, ViewerOps EXPORTS EndOps, ViewerPrivate = BEGIN ProcList: TYPE ~ LIST OF PROC; registerHead: ProcList _ NIL; registerTail: ProcList _ NIL; Register: PUBLIC ENTRY PROC [proc: PROC] = { prev: ProcList ~ registerTail; registerTail _ LIST[proc]; IF prev=NIL THEN registerHead _ registerTail ELSE prev.rest _ registerTail; }; ProcessEndOpsRegistry: PUBLIC PROC = { FOR list: ProcList _ registerHead, list.rest UNTIL list = NIL DO list.first[ ! RuntimeError.UNCAUGHT => CONTINUE]; ENDLOOP; }; idleProcess: PROCESS _ NIL; neverEnableAutoIdle: BOOL _ FALSE; autoIdleCond: CONDITION; NoteAutoIdleChange: ENTRY UserProfile.ProfileChangedProc = TRUSTED { ENABLE UNWIND => NULL; minutes: INT _ UserProfile.Number["Viewers.AutoIdleTimeout", 20]; IF neverEnableAutoIdle THEN minutes _ 0; SELECT minutes FROM <= 0, >= 40 => { Process.DisableTimeout[@autoIdleCond]; idleProcess _ NIL; BROADCAST autoIdleCond; }; ENDCASE => { Process.SetTimeout[@autoIdleCond, Process.SecondsToTicks[minutes*60]]; idleProcess _ FORK AutoIdle[]; BROADCAST autoIdleCond; }; }; AutoIdle: ENTRY PROC = TRUSTED { ENABLE UNWIND => NULL; increek: ClassIncreek.Increek _ ClassIncreek.NewStdIncreek[]; DO ClassIncreek.SetAtLatest[increek]; WAIT autoIdleCond; IF neverEnableAutoIdle THEN EXIT; IF Process.GetCurrent[] # idleProcess THEN EXIT ELSE { action: ClassIncreek.ActionBody _ ClassIncreek.GetAction[self: increek, waitMode: dontWait, acceptance: clicksAndMotion ! ClassIncreek.IncreekError => LOOP]; IF neverEnableAutoIdle THEN EXIT; IF Process.GetCurrent[] = idleProcess THEN WITH a: action SELECT FROM timedOut => IF IdleProc # NIL THEN { idleProcess _ NIL; Process.Detach[FORK IdleProc[NIL]]; RETURN; }; ENDCASE; }; ENDLOOP; }; useIdleCrock: BOOL _ TRUE; -- can be set to FALSE to provoke the bug IdleProcInit: Buttons.ButtonProc = { IF NOT Idle.IsIdle[] THEN { Idle.Sleep[]; IF useIdleCrock AND SystemVersion.machineType = dandelion THEN ViewerOps.PaintEverything[]; }; }; IdleProc: Buttons.ButtonProc _ IdleProcInit; [] _ Buttons.Create[ info: [name: "Idle"], proc: IdleProc, fork: TRUE, documentation: "Hide desktop pending user login"]; UserProfile.CallWhenProfileChanges[NoteAutoIdleChange]; END. EndOpsImpl.mesa Copyright c 1985, 1986 by Xerox Corporation. All rights reserved. Doug Wyatt, April 21, 1985 4:03:53 pm PST Russ Atkinson (RRA) April 18, 1986 3:52:53 pm PST EndOps related stuff Auto-Idle stuff (formerly in ViewerProcessesImpl) AutoIdle terminates when not running in this process. To make AutoIdle ignore the profile, set this to TRUE We wait on this condition, which will either time out or cause AutoIdle to finish [reason: UserProfile.ProfileChangeReason] This will cause us to idle, and the profile changed proc will start up a new process for AutoIdle. If we called this directly, then we could lock up since NoteAutoIdleChange is an ENTRY proc. (Thanks, Doug) 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. Κ»– "Mesa" style˜codešœ™Kšœ Οmœ7™BK™)K™1—™šΟk ˜ Kšœžœ˜#Kšœ žœL˜^Kšœžœ˜Kšœžœ˜KšœžœB˜OKšœ žœžœ˜Kšœžœ˜"Kšœ žœ6˜GKšœžœ ˜Kšœ žœ˜"Kšœžœ˜——K˜šΠbl œžœž˜KšžœZ˜aKšžœ˜Kšœž˜K˜—šœ™K˜Kš œ žœžœžœžœ˜Kšœžœ˜Kšœžœ˜K˜š Οnœžœžœžœžœ˜,Kšœ˜Kšœžœ˜Kšžœžœžœžœ˜KKšœ˜K˜—š œžœžœ˜&šžœ*žœžœž˜@Kšœžœžœ˜1Kšžœ˜—Kšœ˜—K˜—šœ1™1K˜šœ žœžœ˜Kšœ5™5—šœžœžœ˜"Kšœ1ž™5—šœž œ˜KšœQ™Q—K˜•StartOfExpansion- -- [reason: UserProfile.ProfileChangeReason]š œžœ"žœ˜DKšΠck)™)Kšžœžœžœ˜Kšœ žœ5˜AKšžœžœ ˜(šžœ ž˜šœ˜Kšœ&˜&Kšœžœ˜Kšž œ˜Kšœ˜—šžœ˜ KšœF˜FKšœžœ ˜Kšž œ˜K˜——K˜—K˜š œžœžœžœ˜ Kšžœžœžœ˜K˜=šž˜K˜"Kšžœ˜Kšžœžœžœ˜!šžœ$žœžœžœ˜6šœw˜wKšœžœ˜%—Kšžœžœžœ˜!šžœ$ž˜*šžœ žœž˜šœ žœ žœžœ˜$Kšœžœ˜šœžœ žœ˜#Kšœ΅žœ™Π—Kšžœ˜K˜—Kšžœ˜——K˜—Kšžœ˜—Kšœ˜K˜—šœžœžœΟc)˜EK˜—š  œ˜$šžœžœžœ˜Kšœ ˜ šžœžœ'ž˜>šœ&™&Kšœ―™―—Kšœ˜—K˜—Kšœ˜K˜—Kš œ$˜,šœ˜Kšœ,žœ˜1K˜2—K˜Kšœ7˜7K˜—Kšžœ˜—…— θ±