|##########| |#MAGIC #|CLABLJAP |#PROJECT #|"IMPORTALL" |#PATHS #|"StdProject" |#FLAGS #|xx---x-xx---xxx----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx---xxxxx------ |##########| DEFINITION MODULE Input; (* $A- *) FROM Resources IMPORT ContextPtr; FROM Timer IMPORT TimeVal; FROM T_Exec IMPORT nonstdVAL,IOCommand,IOStdReq; TYPE IOInputPtr = POINTER TO IOInput; IOInput = RECORD OF IOStdReq END; ScreenPtr = DEFERRED POINTER Intuition.ScreenPtr; Class = (null, rawkey, rawmouse, event, pointerpos, c15, timer, gadgetdown, gadgetup, requester, menulist, closewindow, sizewindow, refreshwindow, newprefs, diskremoved, diskinserted, activewindow, inactivewindow, newpointerpos, menuhelp, changewindow ); CONST classMax = CARDINAL( Class'MAX ); TYPE SubClass = (compatible, pixel, tablet ); Coord = RECORD x, y : INTEGER; END; | pointed to by InputEvent.eventAddress. | the key is in InputEvent.subClass. IEObjectPtr = POINTER TO IEObject; IEObject = RECORD IF KEY : SubClass OF pixel THEN screen : ScreenPtr; position : Coord; OF tablet THEN range, value : Coord; pressure : INTEGER; END END; CONST | rawkey commCodeFirst = $78; commCodeLast = $7F; keyCodeFirst = $00; keyCodeLast = $77; upPrefix = $80; | ansi asciiDel = $7F; asciiFirst = $A0; asciiLast = $7E; c0First = $00; c0Last = $1F; c1First = $80; c1Last = $9F; latin1First = $A0; latin1Last = $FF; | rawmouse lButton = $68; mButton = $6A; noButton = $FF; rButton = $69; | event newActive = $01; newSize = $02; refresh = $03; | requester reqClear = $00; reqSet = $01; TYPE Qualifiers = (lShift, rShift, capsLock, control, lAlt, rAlt, lCommand, rCommand, numericPad, repeat, interrupt, multiBroadcast, midButton, rightButton, leftButton, relativeMouse ); QualifierSet = SET OF Qualifiers; KeyQualSet = SET OF [lShift..rCommand]; InputEventPtr = POINTER TO InputEvent; InputEvent = RECORD nextEvent : InputEventPtr; class : Class; subClass : SubClass; code : CARDINAL; qualifier : QualifierSet; IF KEY : Class OF newpointerpos THEN event : IEObjectPtr; OF rawkey THEN prev1DownCode : SHORTCARD; prev1DownQual : KeyQualSet; prev2DownCode : SHORTCARD; prev2DownQual : KeyQualSet; OF pointerpos THEN x,y : INTEGER END; timeStamp : TimeVal; END; CONST addHandler = IOCommand( nonstdVAL + 0 ); remHandler = IOCommand( nonstdVAL + 1 ); writeEvent = IOCommand( nonstdVAL + 2 ); setTresh = IOCommand( nonstdVAL + 3 ); setPeriod = IOCommand( nonstdVAL + 4 ); setMPort = IOCommand( nonstdVAL + 5 ); setMType = IOCommand( nonstdVAL + 6 ); setMTrig = IOCommand( nonstdVAL + 7 ); PROCEDURE OpenInput( context : ContextPtr:=NIL ): IOInputPtr; PROCEDURE CloseInput( VAR request : IOInputPtr ); GROUP EventGrp = Class, classMax, SubClass, Qualifiers, QualifierSet, IEObject, IEObjectPtr, InputEventPtr, InputEvent; CommandGrp = addHandler, remHandler, writeEvent, setTresh, setPeriod, setMPort, setMType, setMTrig; FuncGrp = IOInputPtr, OpenInput, CloseInput; All = CommandGrp, FuncGrp, T_Exec.ExecIOGrp, EventGrp; END Input.