-- Compiler GriffinInput/n -- Tiberi December 11, 1979 4:25 PM DIRECTORY GriffinInputDefs: FROM "GriffinInputDefs", StreamDefs: FROM "StreamDefs" USING [KeyboardHandle,GetDefaultKey], PointDefs: FROM "PointDefs" USING [ScrPt], CursorDefs: FROM "CursorDefs" USING [CursorPosition], ProcessDefs: FROM "ProcessDefs" USING [Yield], KeyDefs: FROM "KeyDefs"; GriffinInput: PROGRAM IMPORTS StreamDefs, CursorDefs, ProcessDefs EXPORTS GriffinInputDefs = BEGIN OPEN GriffinInputDefs; Input: PUBLIC PROCEDURE [handler: InputEventProc] = BEGIN oldMouseButton: KeyDefs.MouseButton _ KeyDefs.Mouse.buttons; keys: StreamDefs.KeyboardHandle = StreamDefs.GetDefaultKey[]; oldPoint: PointDefs.ScrPt _ [0,0]; point: PointDefs.ScrPt; shifted: BOOLEAN; DO --forever ProcessDefs.Yield; point _ CursorDefs.CursorPosition[]; shifted _ KeyDefs.Keys.LeftShift = down OR KeyDefs.Keys.RightShift = down; IF KeyDefs.Mouse.buttons # oldMouseButton THEN BEGIN oldMouseButton _ KeyDefs.Mouse.buttons; SELECT oldMouseButton FROM Red => handler[[red,,point,shifted]]; Yellow => handler[[yellow,,point,shifted]]; Blue => handler[[blue,,point,shifted]]; None => handler[[up,,point,shifted]]; ENDCASE => handler[[multiple,,point,shifted]]; END ELSE IF ~ keys.endof[keys] THEN handler[[keyStroke, keys.get[keys], point, FALSE]] ELSE IF oldPoint # point THEN handler[[newPosition, , point, shifted]]; oldPoint _ point ENDLOOP END; END.