DEFINITION MODULE InputEvent; (*$ Implementation:=FALSE *)
(* 17-May-1993/bp *)

FROM SYSTEM IMPORT ADDRESS;

FROM Timer IMPORT TimeVal;
FROM UtilityD IMPORT HookPtr;

TYPE
 Class=(
  null,rawkey,rawmouse,event,pointerpos,cl5,timer,gadgetdown,
  gadgetup,requester,menulist,closewindow,sizewindow,
  refreshwindow,newprefs,diskremoved,diskinserted,
  activewindow,inactivewindow,
  (*36*)newpointerpos,(*36*)menuhelp,(*36*)changewindow
 );

CONST
 classMax=ORD(MAX(Class));

 (*36*)subClassCompatible=Class(0);
 (*36*)subClassPixel=Class(1);
 (*36*)subClassTablet=Class(2);

TYPE
 (*36*)Vec2=RECORD
        x,y:CARDINAL;
       END;

 (*36*)PointerPixel=RECORD
        screen:ADDRESS;
        position:Vec2;
       END;
 (*36*)PointerPixelPtr=POINTER TO PointerPixel;

 (*36*)PointerTablet=RECORD
        range:Vec2;
        value:Vec2;
        pressure:INTEGER;
       END;
 (*36*)PointerTabletPtr=POINTER TO PointerTablet;

 (*39*)NewTablet=RECORD
        callBack:HookPtr;
        scaledX,
        scaledY:CARDINAL;
        scaledXFraction,
        scaledYFraction:CARDINAL;
        tabletX,
        tabletY:LONGCARD;
        rangeX,
        rangeY:LONGCARD;
        tagList:ADDRESS;
       END;
 (*39*)NewTabletPtr=POINTER TO NewTablet;

CONST
 upPrefix=080H;
 keyCodeFirst=00H;
 keyCodeLast=077H;
 commCodeFirst=078H;
 commCodeLast=07FH;
 c0First=00H;
 c0Last=01FH;
 asciiFirst=020H;
 asciiLast=07EH;
 asciiDel=07FH;
 c1First=080H;
 c1Last=09FH;
 latin1First=0A0H;
 latin1Last=0FFH;
 lButton=068H;
 rButton=069H;
 mButton=06AH;
 noButton=0FFH;
 (*36*)newActive=01H;
 (*36*)newSize=02H;
 (*36*)refresh=03H;
 reqClear=00H;
 reqSet=01H;

TYPE
 Qualifiers=(
  lShift,rShift,capsLock,control,lAlt,rAlt,lCommand,rCommand,
  numericPad,repeat,interrupt,multiBroadcast,midButton,
  rightButton,leftButton,relativeMouse
 );
 QualifierSet=SET OF Qualifiers;
 ShortQualifierSet=SET OF [lShift..rCommand]; (* 1 Byte *)

 InputEventPtr=POINTER TO InputEvent;
 InputEvent=RECORD
  nextEvent:InputEventPtr;
  class:Class;
  subClass:Class;
  code:CARDINAL;
  qualifier:QualifierSet;
  CASE :INTEGER OF
  | 0:
   x,y:INTEGER;
  | 1:
   eventAddress:ADDRESS;
  | 2:
   prev1DownCode:SHORTCARD;
   prev1DownQual:ShortQualifierSet;
   prev2DownCode:SHORTCARD;
   prev2DownQual:ShortQualifierSet;
  END;
  timeStamp:TimeVal
 END;

END InputEvent.noimp
