SVInputMonitorImpl.mesa
Author: Eric Bier on December 9, 1982 11:33 pm
Last edited by Bier on July 1, 1983 5:41 pm
Contents: A flexible setup, suggested by Scott McGregor, for processing mouse input as fast as you can (but no faster). I will use it to synchronize my mouse point processing with the mousepoint. If the processing algorithms become faster, this procedure will still do the right thing.
DIRECTORY
Menus,
Process,
SV2d,
SVInputMonitor,
SVViewerTool,
SVViewerInput;
SVInputMonitorImpl: MONITOR
IMPORTS Process, SVViewerInput
EXPORTS SVInputMonitor =
BEGIN
MouseButton: TYPE = Menus.MouseButton;
Point2d: TYPE = SV2d.Point2d;
ViewerToolData: TYPE = SVViewerTool.ViewerToolData;
globalProcess: PROCESSNIL;
cameraCoords: Point2d;
clickAtom: ATOM;
vtData: ViewerToolData ← NIL;
globalNew: BOOLFALSE;
NewMotion: PUBLIC ENTRY PROC [pt: Point2d, atom: ATOM, viewerToolData: ViewerToolData] = {
globalNew ← TRUE;
cameraCoords ← pt;
vtData ← viewerToolData;
clickAtom ← atom;
IF globalProcess = NIL THEN Process.Detach[globalProcess ← FORK Painter];
};
Painter: PROC = {
WHILE New[] DO
Dispatch[cameraCoords, clickAtom, vtData];
ENDLOOP;
};
New: PUBLIC ENTRY PROC RETURNS [x: BOOL] = {
x ← globalNew;
globalNew ← FALSE;
IF NOT x THEN globalProcess ← NIL; -- no mouse action. Let process die.
};
Dispatch: PROC [controlPoint: Point2d, atom: ATOM, viewerToolData: ViewerToolData] = {
SELECT atom FROM
$SetPrimarySelection => SVViewerInput.SetPrimarySelection[viewerToolData, controlPoint];
$SetSecondarySelection => SVViewerInput.SetSecondarySelection[viewerToolData, controlPoint];
ENDCASE;
};
END.