<<>> <> <> <> <> <<>> <> <<>> DIRECTORY Rope, Xl; XlInputExtension: CEDAR DEFINITIONS ~ BEGIN <> <<>> <> <<>> <> <> <> Int32Sequence: TYPE ~ RECORD[SEQUENCE leng: NAT OF INT32]; InputClass: TYPE ~ MACHINE DEPENDENT {keyClass(0), buttonClass(1), valuatorClass(2), feedbackClass(3), proximityClass(4), focusClass(5), otherClass(6), (255)}; <> <<>> DeviceId: TYPE ~ DeviceIdBase[0..128); <> DeviceIdBase: TYPE = [0..256); --Used to be able to hold special input values, and, sometimes to allocate the right number of bits. <> GetExtensionVersion: PROC [c: Xl.Connection, name: Rope.ROPE] RETURNS [present: BOOL, majorVersion, minorVersion: INT]; <> <<>> ListInputDevices: PROC [c: Xl.Connection] RETURNS [LIST OF DeviceInfo]; <> DeviceInfo: TYPE ~ RECORD [ type: Xl.XAtom, --nature of device; defined types listed below id: DeviceId, --uniquely identifies device numClasses: BYTE, use: CurrentUse, --describes current use info: LIST OF REF InputInfo, name: Rope.ROPE --one of the defined types ]; CurrentUse: TYPE = {isXPointer, isXKeyboard, isExtensionDevice}; InputInfo: TYPE ~ RECORD [ class: InputClass, info: SELECT type: InfoSelector FROM keyInfo => [ min: BYTE, max: BYTE, number: CARD16], buttonInfo => [ number: CARD16], valuatorInfo => [ supportsRelative: BOOL, supportsAbsolute: BOOL, motionBufferSize: CARD32, axisInfo: SEQUENCE numberOfAxis: BYTE OF AxisInfo], ENDCASE ]; InfoSelector: TYPE ~ {keyInfo, buttonInfo, valuatorInfo}; AxisInfo: TYPE ~ RECORD [ resolution: CARD32, min: CARD32, max: CARD32 ]; <> OpenDevice: PROC [c: Xl.Connection, id: DeviceId] RETURNS [REF OpenDeviceRec]; <> OpenDeviceRec: TYPE ~ RECORD [ id: DeviceId, --same id classes: SEQUENCE numClasses: INT OF InputClassInfo ]; InputClassInfo: TYPE ~ PACKED RECORD [ inputClass: InputClass, eventTypeBase: BYTE --this is used to compose values for EventClass ]; <> <<>> CloseDevice: PROC [c: Xl.Connection, deviceId: DeviceId, details: Xl.Details ¬ NIL]; <> <<>> SetDeviceMode: PROC [c: Xl.Connection, deviceId: DeviceId, relativeMode: BOOL] RETURNS [status: DeviceStatus]; <> DeviceStatus: TYPE ~ MACHINE DEPENDENT {success, alreadyGrabbed, deviceBusy}; SetDeviceValuators: PROC [c: Xl.Connection, deviceId: DeviceId, first: INT, values: LIST OF INT] RETURNS [status: ValuatorStatus]; <> ValuatorStatus: TYPE ~ MACHINE DEPENDENT {success, alreadyGrabbed}; GetDeviceMotionEvents: PROC [c: Xl.Connection, deviceId: DeviceId, start, stop: Xl.TimeStamp ¬ Xl.currentTime] RETURNS [REF DeviceTimeCoords]; <> DeviceTimeCoords: TYPE; IsAbsolute: PROC [dtc: REF DeviceTimeCoords] RETURNS [BOOL]; AxisCount: PROC [dtc: REF DeviceTimeCoords] RETURNS [NAT]; NumberOfEvents: PROC [dtc: REF DeviceTimeCoords] RETURNS [NAT]; TimeOfEvent: PROC [dtc: REF DeviceTimeCoords, eventNum: NAT] RETURNS [Xl.TimeStamp]; ValuatorOfEvent: PROC [dtc: REF DeviceTimeCoords, eventNum: NAT, valuatorNum: NAT] RETURNS [CARD32]; QueryDeviceState: PROC [c: Xl.Connection, deviceId: DeviceId] RETURNS [InputStates]; <> InputStates: TYPE ~ RECORD [ numberOfClasses: BYTE, states: LIST OF REF InputState ]; InputState: TYPE ~ RECORD [ number: BYTE, s: SELECT class: InputClass FROM keyClass => [ keys: PACKED ARRAY [0..31] OF BYTE ], buttonClass => [ buttons: PACKED ARRAY [0..31] OF BYTE ], valuatorClass => [ relativeMode: BOOL, inProximity: BOOL, valuators: REF Int32Sequence ¬ NIL ], ENDCASE ]; <> EventClass: TYPE ~ CARD32; <> <<>> EventClasses: TYPE ~ REF Xl.Card32Sequence; <> MakeEventClass: PROC [od: REF READONLY OpenDeviceRec, request: RequestableEvent] RETURNS [EventClass]; <> <> RequestableEvent: TYPE = MACHINE DEPENDENT { devicePointerMotionHint, deviceButton1Motion, deviceButton2Motion, deviceButton3Motion, deviceButton4Motion, deviceButton5Motion, deviceButtonMotion, deviceButtonGrab, deviceOwnerGrabButton, noExtensionEvent, deviceKeyPress, deviceKeyRelease, deviceButtonPress, deviceButtonRelease, deviceMotionNotify, deviceFocusIn, deviceFocusOut, proximityIn, proximityOut, deviceStateNotify, deviceMappingNotify, changeDeviceNotify, (255)}; <> <> SelectExtensionEvents: PROC [c: Xl.Connection, window: Xl.Window, interest: LIST OF EventClass, details: Xl.Details ¬ NIL]; <> GetSelectedExtensionEvents: PROC [c: Xl.Connection, window: Xl.Window] RETURNS [thisClient: EventClasses, allClients: EventClasses]; <> ChangeDeviceDontPropagateList: PROC [c: Xl.Connection, window: Xl.Window, eventClass: LIST OF EventClass, mode: ListModifierMode, details: Xl.Details ¬ NIL]; <> ListModifierMode: TYPE = MACHINE DEPENDENT {addToList, deleteFromList}; GetDeviceDontPropagateList: PROC [c: Xl.Connection, window: Xl.Window] RETURNS [dontPropagateList: EventClasses]; <> <> ChangeReply: TYPE ~ MACHINE DEPENDENT {success, alreadyGrabbed, deviceFrozen}; ChangePointerDevice: PROC [c: Xl.Connection, deviceId: DeviceId, xaxis, yaxis: BYTE] RETURNS [ChangeReply]; <> <> <> GrabDevice: PROC [c: Xl.Connection, deviceId: DeviceId, grabWindow: Xl.Window, ownerEvents: BOOL, eventList: LIST OF EventClass, thisDeviceMode: Xl.Synchronicity, otherDeviceMode: Xl.Synchronicity, time: Xl.TimeStamp ¬ Xl.currentTime] RETURNS [Xl.GrabStatus]; <> UngrabDevice: PROC [c: Xl.Connection, deviceId: DeviceId, time: Xl.TimeStamp ¬ Xl.currentTime, details: Xl.Details ¬ NIL]; <> <> useXKeyboard: DeviceIdBase ~ 0FFH; --for GrabDeviceButton, UngrabDeviceButton anyButton: BYTE ~ 0; --for GrabDeviceButton, UngrabDeviceButton GrabDeviceButton: PROC [c: Xl.Connection, deviceId: DeviceId, grabWindow: Xl.Window, modifiers: Xl.SetOfKeyButMask ¬ [anyModfier: TRUE], modifierDevice: DeviceIdBase ¬ useXKeyboard, button: BYTE ¬ anyButton, ownerEvents: BOOL, eventList: LIST OF EventClass, thisDeviceMode: Xl.Synchronicity, otherDeviceMode: Xl.Synchronicity, details: Xl.Details ¬ NIL]; <> UngrabDeviceButton: PROC [c: Xl.Connection, deviceId: DeviceId, grabWindow: Xl.Window, modifiers: Xl.SetOfKeyButMask ¬ [anyModfier: TRUE], modifierDevice: DeviceIdBase ¬ useXKeyboard, button: BYTE ¬ anyButton, details: Xl.Details ¬ NIL]; <> <<>> <> <<>> AllowDeviceEventsMode: TYPE ~ MACHINE DEPENDENT {asyncThisDevice, syncThisDevice, replayThisDevice, asyncOtherDevices, asyncAll, syncAll}; AllowDeviceEvents: PROC [c: Xl.Connection, deviceId: DeviceId, time: Xl.TimeStamp ¬ Xl.currentTime, mode: AllowDeviceEventsMode, details: Xl.Details ¬ NIL]; <> <> DeviceFocusReversion: TYPE ~ MACHINE DEPENDENT {none, pointerRoot, parent, followKeyboard}; --like FocusReversion but additional value followKeyboard focusNone: Xl.Window ~ [[0]]; focusPointerRoot: Xl.Window ~ [[1]]; focusFollowKeyboard: Xl.Window ~ [[3]]; DeviceFocusRec: TYPE ~ RECORD [ window: Xl.Window ¬ Xl.nullWindow, revertTo: DeviceFocusReversion ¬ none, time: Xl.TimeStamp ¬ Xl.currentTime ]; GetDeviceFocus: PROC [c: Xl.Connection, deviceId: DeviceId] RETURNS [DeviceFocusRec]; SetDeviceFocus: PROC [c: Xl.Connection, deviceId: DeviceId, dfr: DeviceFocusRec ¬ [], details: Xl.Details ¬ NIL]; <> <> GetDeviceButtonMapping: PROC [c: Xl.Connection, deviceId: DeviceId] RETURNS [Xl.PointerMapping]; <> <> deviceKeyPressKey, deviceKeyReleaseKey, deviceButtonPressKey, deviceButtonReleaseKey, deviceMotionNotifyKey, deviceFocusInKey, deviceFocusOutKey, proximityInKey, proximityOutKey, deviceStateNotifyKey, deviceMappingNotifyKey, changeDeviceNotifyKey: READONLY REF ANY; <> <> <<>> <> EventOffset: TYPE ~ MACHINE DEPENDENT {deviceValuator(0), deviceKeyPress(1), deviceKeyRelease(2), deviceButtonPress(3), deviceButtonRelease(4), deviceMotionNotify(5), deviceFocusIn(6), deviceFocusOut(7), proximityIn(8), proximityOut(9), deviceStateNotify(10), deviceMappingNotify(11), changeDeviceNotify(12), deviceKeyStateNotify(13), deviceButtonStateNotify(14)}; <> EventDataType: TYPE ~ {deviceBase, deviceFocus, deviceState, deviceMapping, deviceChange}; <> ExtEvent: TYPE ~ REF READONLY ExtEventRep; ExtEventRep: TYPE ~ RECORD [ <<--This is the thing where the "decoded" field of an Xl.EventRep.extension points to.>> eventOffset: EventOffset, seq: Xl.SequenceNo ¬ 0, time: Xl.TimeStamp, deviceId: DeviceId, details: SELECT type: EventDataType FROM deviceBase => [ <<--deviceKeyPress, deviceKeyRelease, deviceButtonPress, deviceButtonRelease, deviceMotionNotify, proximityIn, proximityOut >> <<--(hidden deviceValuator)>> rootWindow: Xl.Window, eventWindow: Xl.Window, childWindow: Xl.Window, -- ¬ nullWindow, sameScreen: BOOL, rootPos: Xl.Point, eventPos: Xl.Point, --of core pointer (even if device itself points somewhere else) state: Xl.SetOfKeyButMask, --of core buttons and modifiers (just before event) <> <<--For deviceKeyPress, deviceKeyRelease>> keyCode: Xl.KeyCode ¬ VAL[0], <<--For deviceButtonPress, deviceButtonRelease>> button: BYTE ¬ 0, <<--For deviceMotionNotify>> <<-- BTW: granularity of motion not defined>> normalHint: Xl.NormalHint ¬ normal, <<--For proximityIn, proximityOut>> <<-->> deviceState: Xl.SetOfKeyButMask, --set only if valuators are reported valuators: REF READONLY Int32Sequence ¬ NIL ], deviceFocus => [ <<--deviceFocusIn, deviceFocusOut>> detail: Xl.FocusDetail, eventWindow: Xl.Window, mode: Xl.GrabMode ], deviceState => [ <<--DeviceStateNotify>> <<--(hidden deviceKeyStateNotify, deviceButtonStateNotify)>> numKeys: BYTE, numButtons: BYTE, numValuators: BYTE, relativeMode: BOOL, inProximity: BOOL, keys: REF READONLY PACKED ARRAY [0..31] OF BYTE ¬ NIL, buttons: REF READONLY PACKED ARRAY [0..31] OF BYTE ¬ NIL, valuators: REF READONLY Int32Sequence ¬ NIL ], deviceMapping => [ <<--deviceMapping>> request: Xl.MappingNotifyKind, firstKeycode: BYTE, count: BYTE ], deviceChange => [ <<--changeDeviceNotify>> newWhat: {newPointer, newKeyboard} ], ENDCASE ]; <> <> DeviceBaseEvent: TYPE ~ REF READONLY deviceBase ExtEventRep; DeviceFocusEvent: TYPE ~ REF READONLY deviceFocus ExtEventRep; DeviceStateEvent: TYPE ~ REF READONLY deviceState ExtEventRep; DeviceMappingEvent: TYPE ~ REF READONLY deviceMapping ExtEventRep; DeviceChangeEvent: TYPE ~ REF READONLY deviceChange ExtEventRep; END.