DIRECTORY AMEvents USING [Debugging], ClassIncreek USING [Increek], Cursors USING [CursorType, GetCursor, SetCursor], IconManager USING [IconModify, IconNotify, iconTIP], ImplErrors USING [UserErrorQuery], InputFocus USING [Focus, FocusRec], Interminal USING [terminal], Process USING [GetPriority, Priority, SetPriority], Terminal USING [BlinkBWDisplay], TIPUser USING [CreateParseInfo, CreateClient, DestroyClient, DiscardTypeAhead, InstantiateNewTIPTable, ParseOneEvent, ResetTIPContext, stdCoords, TIPButtonProc, TIPClient, TIPNotifyProc, TIPParseInfo, TIPScreenCoords, TIPTable], ViewerEvents USING [ProcessEvent], ViewerOps USING [MouseInViewer], ViewerClasses USING [Viewer, ModifyAction, NotifyProc], ViewersStallNotifier USING [], WindowManager USING [waitCount], WindowManagerPrivate USING [ProcessWindowResults, VMgrPriority]; InputFocusImpl: CEDAR MONITOR IMPORTS AMEvents, Cursors, IconManager, ImplErrors, Interminal, Process, TIPUser, Terminal, ViewerEvents, ViewerOps, WindowManager, WindowManagerPrivate EXPORTS InputFocus, ViewersStallNotifier SHARES InputFocus, TIPUser, ViewerEvents = BEGIN Focus: TYPE ~ InputFocus.Focus; FocusRec: TYPE ~ InputFocus.FocusRec; Viewer: TYPE ~ ViewerClasses.Viewer; captureProc: ViewerClasses.NotifyProc _ NIL; -- client preempting all button events captureTIP: TIPUser.TIPTable _ NIL; -- TIP Table associated with the capture. captureViewer: Viewer _ NIL; -- focus data private to the capture. SetInputFocus: PUBLIC ENTRY PROC [self: Viewer _ NIL, info: REF _ NIL] = BEGIN ENABLE UNWIND => NULL; -- release lock ModifyInputFocus[kill]; currentFocus.owner _ self; -- note that we don't flush any CaptureButtons! currentFocus.info _ info; currentFocus.link _ NIL; ModifyInputFocus[set]; IF currentFocus.owner#NIL THEN ChangeTIPContext[currentFocus.owner]; END; ModifyInputFocus: PROC [action: ViewerClasses.ModifyAction] = BEGIN ENABLE ANY => {IF ImplErrors.UserErrorQuery[] THEN CONTINUE}; IF action=set THEN IF ViewerEvents.ProcessEvent[setInputFocus, currentFocus.owner, TRUE] THEN RETURN; IF action=kill THEN IF ViewerEvents.ProcessEvent[killInputFocus, currentFocus.owner, TRUE] THEN RETURN; IF currentFocus.owner # NIL THEN BEGIN IF currentFocus.owner.iconic THEN IconManager.IconModify[currentFocus.owner, action] ELSE IF currentFocus.owner.class.modify#NIL THEN currentFocus.owner.class.modify [currentFocus.owner, action]; END; IF action=set THEN [] _ ViewerEvents.ProcessEvent[setInputFocus, currentFocus.owner, FALSE]; IF action=kill THEN [] _ ViewerEvents.ProcessEvent[killInputFocus, currentFocus.owner, FALSE]; END; GetInputFocus: PUBLIC PROC RETURNS [Focus] = {RETURN[currentFocus]} ; PushInputFocus: PUBLIC ENTRY PROC [self: Viewer _ NIL, info: REF _ NIL] = BEGIN ENABLE UNWIND => NULL; -- release lock ModifyInputFocus[push]; currentFocus _ NEW[FocusRec _ [owner: self, info: info, link: currentFocus]]; ModifyInputFocus[set]; ChangeTIPContext[currentFocus.owner]; END; CaptureButtons: PUBLIC ENTRY PROC[proc: ViewerClasses.NotifyProc, tip: TIPUser.TIPTable, viewer: Viewer _ NIL] = BEGIN ENABLE UNWIND => NULL; -- release lock captureProc _ proc; captureTIP _ tip; captureViewer _ viewer; END; PopInputFocus: PUBLIC ENTRY PROC = BEGIN ENABLE UNWIND => NULL; -- release lock IF currentFocus.link = NIL THEN RETURN; ModifyInputFocus[kill]; currentFocus _ currentFocus.link; ModifyInputFocus[pop]; ChangeTIPContext[currentFocus.owner]; END; ChangeTIPContext: PROC [self: Viewer, interrupt: BOOLEAN _ FALSE] = {TIPUser.ResetTIPContext[focusTIP, IF self=NIL THEN NIL ELSE IF self.iconic THEN IconManager.iconTIP ELSE self.tipTable, MasterNotifyProc, interrupt]}; MapCoordinateResults: PROC[results: LIST OF REF ANY, coords: TIPUser.TIPScreenCoords _ NIL] = BEGIN FOR lst: LIST OF REF ANY _ results, lst.rest UNTIL lst = NIL DO SELECT lst.first FROM TIPUser.stdCoords => IF coords#NIL THEN TIPUser.stdCoords^ _ coords^ ELSE [] _ ViewerOps.MouseInViewer[TIPUser.stdCoords]; ENDCASE; ENDLOOP; END; MasterNotifyProc: TIPUser.TIPNotifyProc -- [results: LIST OF REF ANY] -- = BEGIN ENABLE AMEvents.Debugging => PrivateUnWedgeNotifier[]; IF inputEnabled AND currentFocus.owner#NIL THEN BEGIN ENABLE ANY => {IF ImplErrors.UserErrorQuery[] THEN CONTINUE}; IF currentFocus.owner.iconic THEN IconManager.IconNotify[currentFocus.owner, results] ELSE BEGIN MapCoordinateResults[results]; currentFocus.owner.class.notify[currentFocus.owner, results]; END; END; END; MasterButtonProc: TIPUser.TIPButtonProc = BEGIN ENABLE AMEvents.Debugging => PrivateUnWedgeNotifier[]; results: LIST OF REF ANY; viewer: ViewerClasses.Viewer; client: BOOL; TIPParse: PROC [table: TIPUser.TIPTable, mapCoords: BOOLEAN _ TRUE] = BEGIN parseInfo.inCreek _ state; -- OK since we only ever do one parse parseInfo.tableHead _ table; results _ TIPUser.ParseOneEvent[parseInfo]; IF mapCoords THEN MapCoordinateResults[results, screenXY]; END; IF ~inputEnabled THEN RETURN; IF captureProc#NIL THEN BEGIN TIPParse[captureTIP, FALSE]; IF results#NIL THEN captureProc[captureViewer, results ! ANY => {IF ImplErrors.UserErrorQuery[] THEN CONTINUE}]; RETURN[TRUE]; END; [viewer, client] _ ViewerOps.MouseInViewer[screenXY]; IF viewer=NIL THEN BEGIN IF WindowManager.waitCount=0 AND Cursors.GetCursor[]#textPointer THEN Cursors.SetCursor[textPointer]; TIPParse[NIL, FALSE] -- consume event END ELSE IF viewer.iconic THEN BEGIN TIPParse[IconManager.iconTIP, FALSE]; IF results#NIL THEN IconManager.IconNotify[viewer, results ! ANY => {IF ImplErrors.UserErrorQuery[] THEN CONTINUE}]; END ELSE IF client THEN BEGIN IF WindowManager.waitCount=0 AND viewer.class.cursor#Cursors.GetCursor[] THEN Cursors.SetCursor[viewer.class.cursor]; TIPParse[viewer.tipTable]; IF results#NIL THEN viewer.class.notify[viewer, results ! ANY => {IF ImplErrors.UserErrorQuery[] THEN CONTINUE}]; END ELSE BEGIN TIPParse[WindowManagerTIPTable]; IF results#NIL THEN WindowManagerPrivate.ProcessWindowResults[viewer, results ! ANY => {IF ImplErrors.UserErrorQuery[] THEN CONTINUE}]; END; RETURN[TRUE]; END; UnWedgeNotifier: PUBLIC PROC [process: PROCESS, kind: ATOM] = BEGIN END; PrivateUnWedgeNotifier: PROC = BEGIN TRUSTED {Interminal.terminal.BlinkBWDisplay[]}; currentFocus _ NEW[FocusRec]; TIPUser.DestroyClient[focusTIP]; -- destroy old notifier StartTIP[]; -- make a new notifier END; EnableInput: PUBLIC PROC = BEGIN TIPUser.DiscardTypeAhead[focusTIP]; inputEnabled _ TRUE; END; inputEnabled: PUBLIC BOOLEAN _ FALSE; -- procs above will ignore TIP input while FALSE parseInfo: TIPUser.TIPParseInfo _ TIPUser.CreateParseInfo[]; currentFocus: Focus _ NEW[FocusRec]; -- this is the head of the focus stack WindowManagerTIPTable: PUBLIC TIPUser.TIPTable _ TIPUser.InstantiateNewTIPTable["WindowMgr.tip"]; focusTIP: PUBLIC TIPUser.TIPClient; StartTIP: PROC = TRUSTED BEGIN oldPriority: Process.Priority = Process.GetPriority[]; Process.SetPriority[WindowManagerPrivate.VMgrPriority]; -- so TIP forked at VMgrPriority focusTIP _ TIPUser.CreateClient[buttons: MasterButtonProc, notify: MasterNotifyProc]; TIPUser.DiscardTypeAhead[focusTIP]; Process.SetPriority[oldPriority]; END; StartTIP[]; END. BInputFocusImpl.mesa Copyright c 1983, 1984 Xerox Corporation. All rights reserved. McGregor, June 3, 1983 3:48 pm Maxwell, January 24, 1983 3:06 pm Paul Rovner, June 15, 1983 5:14 pm Russ Atkinson, November 18, 1983 1:29 pm Doug Wyatt, September 4, 1984 3:03:02 pm PDT convert a TIPNotify into an InputFocusNotify. [screenXY: TIPScreenCoords, button: Interminal.KeyName, state: ClassIncreek.Increek] RETURNS [consume: BOOL _ FALSE] NOP since handled by informational signals in MasterNotify and MasterButton procs exciting code to make a new notifier when ours is dying Κρ– "Mesa" style˜šΟc™Jšœ Οmœœ/™?Jš™Jšœ!™!Jšœ"™"J™(J™,—J˜šΟk ˜ Jšœ Ÿœ ˜Jšœ Ÿœ ˜JšœŸœ$˜1Jšœ Ÿœ#˜4Jšœ Ÿœ˜"Jšœ Ÿœ˜#Jšœ Ÿœ ˜JšœŸœ&˜3Jšœ Ÿœ˜ šœŸœA˜NJ˜BJ˜R—Jšœ Ÿœ˜"Jšœ Ÿœ˜ JšœŸœ$˜7JšœŸœ˜JšœŸœ ˜ JšœŸœ&˜@J˜—JšœŸ ˜JšŸœ‘˜˜JšŸœ!˜(JšŸœ"˜(JšœŸ˜J˜JšœŸœ˜Jšœ Ÿœ˜%JšœŸœ˜$J˜Jšœ(Ÿœ&˜TJšœŸœ)˜MJšœŸœ%˜CJ˜šΟn œŸœŸœŸœŸœŸœŸœ˜HJšŸ˜JšŸœŸœŸœ˜&J˜Jšœ/˜JJ˜JšœŸœ˜J˜JšŸœŸœŸœ&˜DJšŸœ˜J˜—š œŸœ'˜=JšŸ˜Jš ŸœŸœŸœŸœŸœ˜=šŸœ Ÿœ˜JšŸœ>ŸœŸœŸœ˜R—šŸœ Ÿœ˜JšŸœ?ŸœŸœŸœ˜S—šŸœŸœŸœŸ˜&JšŸœŸœ3˜TšŸœŸœ!ŸœŸ˜0J˜=—JšŸœ˜—JšŸœ ŸœCŸœ˜\JšŸœ ŸœDŸœ˜^JšŸœ˜J˜—Jš   œŸœŸœŸœ Ÿœ˜EJ˜š œŸœŸœŸœŸœŸœŸœŸ˜OJšŸœŸœŸœ˜&J˜JšœŸœ;˜MJ˜J˜%JšŸœ˜J˜—š  œŸœŸœŸœIŸœ˜pJšŸ˜JšŸœŸœŸœ˜&J˜J˜J˜JšŸœ˜J˜—š   œŸœŸœŸœŸ˜(JšŸœŸœŸœ˜&JšŸœŸœŸœŸœ˜'J˜J˜!J˜J˜%JšŸœ˜J˜—š œŸœŸœŸœ˜C˜"JšŸœŸœŸœŸœŸœŸœ ŸœŸœ˜UJ˜J˜——š œŸœ ŸœŸœŸœŸœ$Ÿœ˜]JšŸ˜šŸœŸœŸœŸœŸœŸœŸœŸ˜?šŸœ Ÿ˜šœŸœŸœŸœ˜DJšŸœ1˜5—JšŸœ˜—JšŸœ˜—JšŸœ˜J˜—šœ( œŸ˜PJš-™-JšŸœ0˜6š ŸœŸœŸœŸœŸ˜5Jš ŸœŸœŸœŸœŸœ˜=JšŸœŸœ4˜UšŸœŸ˜ J˜J˜=JšŸœ˜—JšŸœ˜—JšŸœ˜J˜—šœ*Ÿ˜/JšT™TJš™JšŸœ0˜6Jš œ ŸœŸœŸœŸœ˜J˜JšœŸœ˜ J˜š  œŸœ&ŸœŸœŸ˜KJšœ%˜@J˜J˜+JšŸœ Ÿœ)˜:JšŸœ˜J˜—JšŸœŸœŸœ˜J˜šŸœ ŸœŸœŸ˜JšœŸœ˜šŸœ ŸœŸœ#˜6Jš œŸœŸœŸœŸœ˜9—JšŸœŸœ˜ JšŸœ˜J˜—J˜5J˜šŸœŸœŸœŸ˜šŸœŸœ!Ÿ˜EJ˜—Jšœ ŸœŸœ˜%JšŸ˜—šŸœŸœŸœŸ˜ JšœŸœ˜%šŸœ ŸœŸœ'˜:Jš œŸœŸœŸœŸœ˜9—JšŸ˜—šŸœŸœŸœŸ˜šŸœŸœ)Ÿ˜MJ˜'—J˜šŸœ ŸœŸœ$˜7Jš œŸœŸœŸœŸœ˜9—JšŸ˜—šŸœŸ˜ J˜ šŸœ ŸœŸœ:˜MJš œŸœŸœŸœŸœ˜9—JšŸœ˜J˜—JšŸœŸœ˜ JšŸœ˜J˜—š  œŸœŸœ ŸœŸœŸ˜CJšŸœN™QJšŸœ˜J˜—š œŸœŸ˜$Jš7™7JšŸœ(˜/JšœŸœ ˜Jšœ!˜8Jšœ ˜"JšŸœ˜J˜—š  œŸœŸœŸ˜ J˜#JšœŸœ˜JšŸœ˜J˜—JšœŸœŸœŸœ0˜VJ˜