ViewerInputQueue.mesa
Last Edited by: Pausch, August 15, 1983 9:35 am
DIRECTORY
ViewerClasses USING [NotifyProc, Viewer];
ViewerInputQueue: CEDAR DEFINITIONS =
BEGIN
Queue: TYPE = REF QueueObj;
QueueObj: TYPE;
Action: TYPE = RECORD [
notify: ViewerClasses.NotifyProc,
viewer: ViewerClasses.Viewer,
list: LIST OF REF ANY
];
Create: PROC [pushModel: BOOLTRUE] RETURNS [Queue];
Creates a queue, into which objects can be placed if they should not be handled immediately by the client's NotifyProc. All items placed into the queue will be completely serialized, i.e. each will be called in the order that the user clicked, and each proc will completely finish execution before the next one starts. If pushModel = FALSE, then actions are to be removed from the queue by a client process, using DequeueAction (below), rather than by this package. The client process should be prepared to handle ABORTED.
EnQueue: PROC [q: Queue, action: Action];
The viewer and list are added in a record on the specified queue. Later, the notifyProc is called in a synchronous manner.
DequeueAction: PROC [q: Queue] RETURNS [ViewerInputQueue.Action];
I don't anticipate this being needed, but it's here in case people want to pull things off the queue themselves.
Flush: PROC [q: Queue, proc: PROC[Action]← NIL];
Flushes all pending button presses and menu selections in the context of q. This procedure can be called, e.g., when some illegal actions suggests the user is confused an further mouse-ahead should be ignored. Proc will get called for each Action in the queue, to allow cleanup, NOTIFY's, etc.
END.