UserInputOps.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, February 19, 1992 0:20 am PST
Christian Jacobi, February 19, 1992 9:55 am PST
DIRECTORY
BasicTime USING [nullGMT, GMT],
KeyMappingTypes USING [Mapping],
KeyStateTypes USING [UpDown],
KeyTypes USING [KeyCode, KeySym],
RelativeTimes USING [nullTimeStamp, TimeStamp],
UserInput USING [Handle];
UserInputOps: CEDAR DEFINITIONS ~
BEGIN
Handle: TYPE = UserInput.Handle;
Create:
PROC [source:
PROC [handle: Handle] ¬
NIL, sourceData:
REF
ANY ¬
NIL, name:
ATOM ¬ $UnNamed]
RETURNS [Handle];
The source proc (if supplied) will be called when a consumer asks for an event and none is available. The source proc may be omitted if InsertAction is being called by a separate process (or processes). name for debugging purposes.
Close:
PROC [handle: Handle];
Cleans up handle
SetAtLatest:
PROC [handle: Handle];
Discards events up to (but not including) the most recent event.
Keyboard
For now a handle has only one keyboard... This is not really right.
SetMapping:
PROC [handle: Handle, mapping: KeyMappingTypes.Mapping];
Defines or changes the mapping betwen keycodes and keysyms.
GetMapping:
PROC [handle: Handle]
RETURNS [mapping: KeyMappingTypes.Mapping];
Gets the current mapping betwen keycodes and keysyms.
GetKeyState:
PROC [handle: Handle, keyCode: KeyTypes.KeyCode]
RETURNS [state: KeyStateTypes.UpDown];
GetLatestKeyState:
PROC [handle: Handle, keyCode: KeyTypes.KeyCode]
RETURNS [state: KeyStateTypes.UpDown];
GetKeySymState:
PROC [handle: Handle, keySym: KeyTypes.KeySym]
RETURNS [state: KeyStateTypes.UpDown];
GetLatestKeySymState:
PROC [handle: Handle, keySym: KeyTypes.KeySym]
RETURNS [state: KeyStateTypes.UpDown];
IsMouseButton:
PUBLIC
PROC [handle: Handle, keyCode: KeyTypes.KeyCode]
RETURNS [
BOOL];
Local convention to maskerade mouse buttons as keycodes. Non standard.
Time
This is time according to the the machine delivering the input.
A Handle might be dynamically directed to a different source of inputs and therefore make large jumps in relative time.
For now a handle has only one relative time... Eventually we might implement handles with multiple sources of inputs.
GetTime:
PUBLIC
PROC [handle: Handle]
RETURNS [RelativeTimes.TimeStamp];
GetLatestTime:
PUBLIC
PROC [handle: Handle]
RETURNS [RelativeTimes.TimeStamp];
time is the time associated with the most recent event received on handle
SetAbsoluteTime:
PROC [handle: Handle, epochGMT: BasicTime.
GMT ¬ BasicTime.nullGMT, epochTimeStamp: RelativeTimes.TimeStamp ¬ RelativeTimes.nullTimeStamp];
epochGMT & epochTimeStamp should both refer to the same moment in time; these are used to calibrate GetAbsoluteTime
GetAbsoluteTime:
PROC [handle: Handle, timeStamp: RelativeTimes.TimeStamp]
RETURNS [gmt: BasicTime.
GMT, milliseconds:
INT];
Finds the absolute time (disregarding relativistic effects and clock drift) corresponding to timeStamp.
END.