Xl.mesa
Copyright Ó 1988, 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, April 13, 1988 12:24:42 pm PDT
Christian Jacobi, April 21, 1992 12:38 pm PDT
DIRECTORY
IO USING [STREAM],
PropList USING [List],
Rope USING [ROPE],
KeyMappingTypes USING [Mapping],
KeyStateTypes USING [KeyboardState],
KeyTypes USING [KeyCode, KeySym],
RelativeTimes USING [InlinePeriod, nullTimeStamp, TimeStamp],
XlEndian USING [PackedRectangle],
XlKeyBut USING [KeyBut, SetOfKeyButMask, SetOfKeyMask, ORSetOfKeyButMask, IncludeKeyButInSet, IsKeyButInSet],
XlSetOfEvent USING [ORSetOfEvents, SetOfEvent];
Xl: CEDAR DEFINITIONS
IMPORTS RelativeTimes, XlKeyBut, XlSetOfEvent ~
BEGIN
Interfacing X Window system version 11.
Conceptual access to complete X protocol for Cedar clients.
Adding mainly type safety, memory ownership and multi-programming capabilities.
This definition module is well documented where it differs from the standard X protocol; however it does not repeat the X protocol documentations.
ROPE: TYPE ~ Rope.ROPE;
Errors
XError: SIGNAL [err: ErrorNotifyEvent];
Raised if X server sends an error reply instead of a normal reply, and, for local reasons.
May be raised dispatched if connection is dead or died while request.
When raised, locks on connection are already released.
Actually an ERROR, not a SIGNAL: proceeding is not allowed except where noted
Raised asynchronously for certain requests.
ErrorKind: TYPE ~ MACHINE DEPENDENT {
nil(0), request(1), value(2), window(3), pixmap(4), atom(5), cursor(6), font(7), match(8), drawable(9), access(10), alloc(11), colormap(12), gContext(13), idChoice(14), name(15), length(16), implementation(17),
otherServer(240),
clientError(251), sizeError(252), otherLocal(253), connectionWedged(254), requestFromDeadConnection(255)
};
If an error is < otherServer it is the orginal value generated by the X server.
If an error is > otherServer its value is made up local.
otherServer: The error is generated by the X server but the value conflicts with possible local values. Look at originalCodeByte for the X error value..
clientError: Arguments are bogus.
sizeError: Arguments do not fit the size limitations of the X protocol or connection.
otherLocal: catchall for more.
connectionWedged: never shappen...
requestFromDeadConnection: connection was dead before or while request is handled.
Basic types
Connection: TYPE ~ REF ConnectionRep;
Describes connection with X11, [display* in XLib]
Unless a conection is closed it will never be garbage collected.
ID: TYPE ~ CARD32;
nullID: ID ~ 0;
Drawable: TYPE ~ RECORD [id: ID];
nullDrawable: Drawable ~ [nullID];
Fontable: TYPE ~ REF ANY;
nullFontable: Fontable ~ NIL;
ColorMap: TYPE ~ RECORD [colorMapID: ID];
nullColorMap: ColorMap ~ [nullID];
ColorMapId: PROC [m: ColorMap] RETURNS [ID] ~ INLINE {
RETURN[m.colorMapID]
};
Window: TYPE ~ RECORD [drawable: Drawable];
position is upper left corner outside of border
origin is upper left corner inside
size is inside exclusive border
All measured in pixels.
nullWindow: Window ~ [nullDrawable];
WindowId: PROC [w: Window] RETURNS [ID] ~ INLINE {
RETURN[w.drawable.id]
};
Font: TYPE ~ REF FontRep;
nullFont: Font ~ NIL;
FontId: PROC [f: Font] RETURNS [ID];
Warning: Actual font on server is freed when font on host is garbage collected; keeping id does not prevent garbage collection.
Visual: TYPE ~ RECORD [visualID: ID];
nullVisual: Visual ~ [nullID];
VisualId: PROC [v: Visual] RETURNS [ID] ~ INLINE {
RETURN[v.visualID]
};
TimeStamp: TYPE ~ RelativeTimes.TimeStamp;
currentTime: TimeStamp ~ RelativeTimes.nullTimeStamp;
Period: PROC [from, to: TimeStamp] RETURNS [INT32] ~ INLINE {
returns time interval from "from" to "to"
assuming neither time is currentTime
RETURN [RelativeTimes.InlinePeriod[from, to]]
};
XAtom: TYPE ~ RECORD [a: CARD32];
AtomId: PROC [a: XAtom] RETURNS [ID] ~ INLINE {
RETURN[a.a]
};
Cursor: TYPE ~ RECORD [id: ID];
nullCursor: Cursor ~ [0];
CursorId: PROC [cursor: Cursor] RETURNS [ID] ~ INLINE {
RETURN[cursor.id]
};
Pixmap: TYPE ~ RECORD [drawable: Drawable];
nullPixmap: Pixmap ~ [nullDrawable];
PixmapId: PROC [p: Pixmap] RETURNS [ID] ~ INLINE {
RETURN[p.drawable.id]
};
Pixel: TYPE ~ CARD32;
Screens: TYPE ~ REF READONLY ScreenSequence;
ScreenSequence: TYPE ~ RECORD [
SEQUENCE numberOfScreens: NAT OF Screen
];
Screen: TYPE ~ REF READONLY ScreenRec;
ScreenRec: TYPE ~ RECORD [
root: Window,
defaultColorMap: ColorMap,
whitePixel: Pixel,
blackPixel: Pixel,
currentInputMasks: SetOfEvent,
sizeInPixels: Size,
sizeInMillimeters: Size,
minInstalledMaps: CARD16,
maxInstalledMaps: CARD16,
rootVisual: Visual,
backingStores: MACHINE DEPENDENT {never, whenMapped, always},
saveUnders: BYTE,
rootDepth: BYTE,
nDepths: BYTE,
connection: Connection, --not standard X
screenNumber: INT, --not standard X
properties: PropList.List ¬ NIL, --not standard X
screenDepthL: ScreenDepthL
];
Format: TYPE ~ RECORD [
depth: BYTE, --only one Format per depth value
bitsPerPixel: BYTE, --1, 4, 8, 16, 24, 32
scanlinePad: BYTE--8, 16, 32
];
ScreenDepthTuples: TYPE ~ RECORD [SEQUENCE num: NAT OF ScreenDepth];
ScreenDepthL: TYPE ~ LIST OF READONLY ScreenDepth;
ScreenDepth: TYPE ~ REF READONLY ScreenDepthRec;
ScreenDepthRec: TYPE ~ RECORD [
screenDepthIndex: NAT, --not standard X; useful to make pixmap caches
screen: Screen, --not standard X; but handy
properties: PropList.List ¬ NIL, --not standard X
depth: BYTE,
nVisualTypes: CARD16,
visuals: LIST OF READONLY VisualType
];
VisualClass: TYPE ~ MACHINE DEPENDENT {staticGray(0), grayScale(1), staticColor(2), pseudoColor(3), trueColor(4), directColor(5)};
VisualType: TYPE ~ REF READONLY VisualTypeRec;
VisualTypeRec: TYPE ~ RECORD [
visual: Visual,
class: VisualClass,
bitsPerRgbValue: BYTE,
colorMapEntries: CARD16,
redMask: CARD32,
greenMask: CARD32,
blueMask: CARD32,
properties: PropList.List ¬ NIL
];
Point: TYPE ~ RECORD [x, y: INT];
Size: TYPE ~ RECORD [width, height: INT];
This interface uses INT for most kinds of spacial data, while the X protocl actually uses 16 bit signed values for positions and 16 bit unsigned values for sizes. This interface is robust in the sense that if values outside the legal range are used, no wedge will occur. But, no promises are made whether values are sensefully clipped or just wrapped around.
dontUse: INT ~ FIRST[INT];
Geometry: TYPE ~ RECORD [
pos: Point ¬ [dontUse, dontUse], --upper left corner (outside of border)
size: Size ¬ [dontUse, dontUse], --inner size (excluding border)
borderWidth: INT ¬ dontUse --all in pixels
];
nullGeometry: Geometry ~ [[0,0], [0,0], 0]; --saves code...
PackedRectangle: TYPE ~ XlEndian.PackedRectangle;
Layed out such that it can be moved to the X server as whole block.
PackedRects: TYPE ~ REF PackedRectangleSequence;
PackedRectangleSequence: TYPE ~ RECORD [
SEQUENCE numberOfRects: NAT OF PackedRectangle
];
SequenceNo: TYPE ~ CARD32 ¬ 0; --only low 16 bits are used by X
Connection access
Endian: TYPE ~ MACHINE DEPENDENT {lsbFirst, msbFirst};
InfoRef: TYPE ~ REF READONLY ConnectionResponseInfoRec;
ConnectionResponseInfoRec: TYPE ~ RECORD [
protocolMajorVersion: CARD16,
protocolMinorVersion: CARD16,
releaseNumber: CARD32,
resourceIdBase: CARD32,
resourceIdMask: CARD32,
motionBufferSize: CARD32,
maxRequestLength: INT, -- reduced by 8
maxRequestLengthBytes: INT, -- reduced by 32
numberOfFORMATs: BYTE,
imageByteOrder: MACHINE DEPENDENT {lsbFirst, msbFirst},
bitmapFormatBitOrder: MACHINE DEPENDENT {leastSignificant, mostSignificant},
bitmapFormatScanlineUnit: BYTE, --8, 16, 32 <=bitmapFormatScanlinePad
bitmapFormatScanlinePad: BYTE, --8, 16, 32
minKeycode: KeyCode,
maxKeycode: KeyCode,
vendor: ROPE,
formats: LIST OF READONLY Format,
screens: Screens
];
Info: PROC [c: Connection] RETURNS [InfoRef] ~ INLINE {
RETURN [c.info];
};
Properties: PROC [c: Connection] RETURNS [PropList.List] ~ INLINE {
RETURN [c.properties];
};
ServiceProperties: PROC [c: Connection] RETURNS [PropList.List] ~ INLINE {
RETURN [c.serviceProperties];
};
ScreenCount: PROC [c: Connection] RETURNS [NAT] ~ INLINE {
RETURN [c.info.screens.numberOfScreens];
};
FirstScreen: PROC [c: Connection] RETURNS [Screen] ~ INLINE {
The numbering of screens comes from the server. The first first screen is used for many system properties.
RETURN [c.info.screens[0]];
};
DefaultScreen: PROC [c: Connection] RETURNS [Screen] ~ INLINE {
The default screen is the one encoded in the server name used for opening the connection; the server does not know which screen is default for a particular connection.
RETURN [c.info.screens[c.defaultScreenNumber]];
};
NthScreen: PROC [c: Connection, i: NAT] RETURNS [Screen] ~ INLINE {
RETURN [c.info.screens[i]];
};
FirstRoot: PROC [c: Connection] RETURNS [w: Window];
The first screens root window
DefaultRoot: PROC [c: Connection] RETURNS [w: Window];
The default screens root window
ServerName: PROC [c: Connection] RETURNS [ROPE] ~ INLINE {
RETURN [c.name];
};
ScreenDepthCount: PROC [c: Connection] RETURNS [NAT] ~ INLINE {
RETURN [c.screenDepthS.num];
};
NthScreenDepth: PROC [c: Connection, n: NAT] RETURNS [ScreenDepth] ~ INLINE {
RETURN [c.screenDepthS[n]];
};
Alive: PROC [c: Connection] RETURNS [BOOL] ~ INLINE {
Returns best guess whether connection is alive [and non NIL]
RETURN [c#NIL AND c.alive];
};
LastTime: PROC [c: Connection] RETURNS [TimeStamp] ~ INLINE {
Returns the last time stamp reported from server
RETURN [c.lastTimeStamp];
};
PutConnectionProp: PROC [c: Connection, key: REF, val: REF ¬ NIL];
Put local property [NO access to the X server]
GetConnectionProp: PROC [c: Connection, key: REF] RETURNS [val: REF];
Get local property [NO access to the X server]
GetConnectionPropAndInit: PROC [c: Connection, key: REF, init: InitializeProcType] RETURNS [val: REF];
Initializing utility for local properties.
Atomically executes init exactly when the connection has no key property, then puts the return value as key property.
InitializeProcType: TYPE ~ PROC [c: Connection, key: REF] RETURNS [val: REF ¬ $x];
PutScreenProp: PROC [screen: Screen, key: REF, val: REF ¬ NIL];
Put local property [NO access to the X server]
GetScreenProp: PROC [screen: Screen, key: REF] RETURNS [val: REF];
Get local property [NO access to the X server]
PutScreenDepthProp: PROC [sd: ScreenDepth, key: REF, val: REF ¬ NIL];
Put local property [NO access to the X server]
GetScreenDepthProp: PROC [sd: ScreenDepth, key: REF] RETURNS [val: REF];
Get local property [NO access to the X server]
PutVisualTypeProp: PROC [vt: VisualType, key: REF, val: REF ¬ NIL];
Put local property [NO access to the X server]
GetVisualTypeProp: PROC [vt: VisualType, key: REF] RETURNS [val: REF];
Get local property [NO access to the X server]
QueryExtension: PROC [c: Connection, name: ROPE] RETURNS [QueryExtensionRec];
Query procedure issuing request; presence on server does not imply existence of a Cedar interface. Clients might more efficiently check availability of particular extensions using its interface directly.
QueryExtensionRec: TYPE ~ RECORD [presentOnServer: BOOL, majorOpcode, firstEvent, firstError: BYTE];
ListExtensions: PROC [c: Connection] RETURNS [LIST OF ROPE];
Server response; presence on server does not imply existence of a Cedar interface.
Connection set up
CreateConnection: PROC [server: ROPE ¬ NIL, synchronized: BOOL ¬ FALSE, applicationKey: ATOM ¬ NIL, errorMatch: Match ¬ NIL, finalMatch: Match ¬ NIL, debugHelp: REF ¬ NIL] RETURNS [c: Connection ¬ NIL];
Returns valid connection or raises connectionNotCreated [retries if resumed]
server: Name of server including display number.
synchronized: Used in requests with NIL details. Ignored if server=NIL.
applicationKey: Key for default value of server and synchronized fields in case of server=NIL.
errorMatch: Special match used for asynchronous errors. Defaulted fields are filled in to call debugger.
finalMatch: Special match used for notification when reference counts transition to zero for all objects. If reference counts are still zero on return, connection will be closed. Note that a freshly created connection starts with a refcount of 1 on the NIL object. (finalMatch.handles is ignored).
debugHelp: For eventual identification of connection in debugger
connectionNotCreated: SIGNAL [why: REF ConnectionRejectInfo];
ConnectionRejectInfo: TYPE ~ RECORD [
failedBeforeReachingXServer: BOOL,
reason: ROPE,
--defined only if X server reached
protocolMajorVersion, protocolMinorVersion: CARD16
];
IncRefCount: PROC [c: Connection, object: REF ¬ NIL];
Prevents automatic close of Connection
DecRefCount: PROC [c: Connection, object: REF ¬ NIL];
Might re-enable automatic close of Connection
CloseConnection: PROC [c: Connection];
Does not raise any error (but of course might cause others to do so)
Flush: PROC [c: Connection, delayed: BOOL ¬ FALSE];
All requests already issued will enter the wire. If ~delayed then right now.
Does not raise any inline errors.
RoundTrip: PROC [c: Connection, details: Details ¬ NIL];
Waits until X server acknowledges having processed the requests
WhenFlush: TYPE ~ {default, dont, soon, now};
LocalErrorReporting: TYPE ~ {ignore, inline, likeRemote};
Details: TYPE ~ REF DetailsRec;
Describes optional more detailed parametrization for execution of requests.
Fields are copied: clients may change fields before replies are returned.
Details may be shared by multiple threads if sequenceNo is ignored.
Errors notified on a per request basis are not forwarded to any per connection error notifier.
DetailsRec: TYPE ~ RECORD [
--output specifications: set by impl and read by client
sequenceNo: SequenceNo ¬ 0, --set by request (...no locking...).
--input specifications: set by client and read by impl
synchronous: BOOL ¬ FALSE, --makes request synchronous (overwrites other fields)
localErrors: LocalErrorReporting ¬ ignore, --Locally recognized X errors, dead connections, but not programming errors
errorMatch: Match ¬ NIL, --called on XError (ignores EventCodes)
overMatch: Match ¬ NIL, --called on known absence of errors
flush: WhenFlush ¬ default,  --default flushes at least soon if a match is given
--command specific options
specific: REF ¬ NIL,   --NIL is ok for all commands.
--client only fields
props: <<PRIVATE>> REF ¬ NIL, --for eventual implementation of property lists
clientData: REF ¬ NIL   --ignored by Xl and its impl
];
Grabs and event handling
GrabServer: PROC [c: Connection, details: Details ¬ NIL];
All other connections to this server are delayed; Not reentrant. Heavy weight.
May time out if after some seconds no mouse key is down. Time-out is considered a client error and must be avoided.
This and the other grabs do not protect from events already "on the way"; this and the other grabs without a return result do not take effect until the server actually handles the request; if a grab is made to execute certain uninteruptedness this does not matter, but, should a client depend on knowledge that the server actually has seen the request [absolute time], issuing a RoundTrip request is suggested.
UngrabServer: PROC [c: Connection, details: Details ¬ NIL];
Defaulting details causes a flush
AllowEventsMode: TYPE ~ MACHINE DEPENDENT {asyncPointer, syncPointer, replayPointer, asyncKeyboard, syncKeyboard, replayKeyboard};
AllowEvents: PROC [c: Connection, mode: AllowEventsMode, time: TimeStamp, details: Details ¬ NIL];
Defaulting details causes a flush
Synchronicity: TYPE ~ MACHINE DEPENDENT {synchronous, asynchronous};
GrabStatus: TYPE ~ MACHINE DEPENDENT {success, alreadyGrabbed, invalidTime, notViewable, frozen};
AddDispatchJunk: PROC [c: Connection, match: Match];
Add event handlers for windows not found
Atoms and properties
Atoms
StandardAtom: PROC [name: ROPE] RETURNS [atom: XAtom];
X atoms
returns standard atom; it is an error to use non standard names
MakeAtom: PROC [c: Connection, name: ROPE] RETURNS [atom: XAtom];
An InternAtom query with create=true
X atoms. For all hosts of this server !
InternAtom: PROC [c: Connection, name: ROPE, create: BOOL ¬ TRUE] RETURNS [atom: XAtom, exist: BOOL];
X atoms. For all hosts of this server !
GetAtomName: PROC [c: Connection, atom: XAtom] RETURNS [name: ROPE];
X atoms
Properties
X properties; all requests go all the way to the X server
ChangePropertyMode: TYPE ~ MACHINE DEPENDENT {replace, prepend, append};
Card16Sequence: TYPE ~ RECORD[SEQUENCE leng: NAT OF CARD16];
Card32Sequence: TYPE ~ RECORD[SEQUENCE leng: NAT OF CARD32];
ChangeProperty: PROC [c: Connection, w: Window, property: XAtom, type: XAtom, mode: ChangePropertyMode ¬ replace, data: REF, start: INT ¬ 0, num: INT ¬ LAST[INT], details: Details ¬ NIL];
X properties
data: one of NIL, ROPE, REF TEXT, REF Card16Sequence, REF Card32Sequence
start: index of first unit used for actual request
num: number of units used for actual request; limited by length of data
details: fine tuning of request
XPropInfo: PROC [data: REF] RETURNS [numberOfUnits, unitSize: INT];
Assumes data to be handed to ChangeProperty; returns number of units and unit size in bytes. data must be one of the types allowed by ChangeProperty. This does not involve the X server.
GetProperty: PROC [c: Connection, w: Window, property: XAtom, supposedType: XAtom ¬ [0], delete: BOOL ¬ FALSE, longOff: INT ¬ 0, longLength: INT ¬ LAST[INT], supposedFormat: BYTE ¬ 0] RETURNS [PropertyReturnRec];
X properties
supposedFormat: speed up some cases
[if supposedFormat#0 and supposedFormat#format then discard value]
PropertyReturnRec: TYPE ~ RECORD [
type: XAtom,
format: BYTE, --one of 0, 8, 16, 32
value: REF,  --one of NIL, ROPE, REF Card16Sequence, REF Card32Sequence
bytesAfter: CARD32--ignore or see X documentation...
];
DeleteProperty: PROC [c: Connection, w: Window, property: XAtom, details: Details ¬ NIL];
X properties
ListProperties: PROC [c: Connection, w: Window] RETURNS [list: LIST OF XAtom ¬ NIL, num: INT];
X properties
RotateProperties: PROC [c: Connection, w: Window, delta: INT, properties: LIST OF XAtom, details: Details ¬ NIL];
This brain damaged X request is supported only for the benefit of ICCCM
ThreadQueues and event distribution
TQ: TYPE ~ REF TQRep;
Think a (TQ) ThreadQueue to be a thread, a queue, and, a lock. The thread ececutes all queued procedures with the lock hold.
Procedures on different TQ's are executed asynchronously.
IsTQ: PROC [x: REF ANY] RETURNS [BOOL];
NarrowTQ: PROC [x: REF ANY] RETURNS [TQ];
PutTQProp: PROC [tq: TQ, key: REF, val: REF ¬ NIL];
GetTQProp: PROC [tq: TQ, key: REF] RETURNS [val: REF];
CreateTQ: PUBLIC PROC [createData: REF ¬ NIL, order: INT ¬ 0, reverse: BOOL ¬ FALSE] RETURNS [tq: TQ];
Creates a ThreadQueue. TQ's are cheap and use process resources only when needed.
createData might be useful to identify tq in the debugger.
order and reverse serve to define a locking order: Clients must get the lock with smaller order before getting lock with larger order. For locks with same order, get the locks in the same order as the create times, unless reverse indicates the opposite.
Enqueue: PROC [tq: TQ, proc: EventProcType, data: REF ¬ NIL, event: Event ¬ NIL];
Enqueues proc on ThreadQueue. Enqueued procedures on TQ are executed in order of enqueueing. Can not cause wedges, but no guarantee for liveness of TQ can be given either.
data typically registered together with proc. proc must not be nested. Certain types of event might cause enqueued procs to be removed from queue.
CallWithLock: PROC [tq: TQ, proc: PROC];
Executes proc with lock of TQ hold. Might have to wait until lock is free. Order of execution of different calls or with queued procs is undefined.
Lock is PROCESS reentrant.
Might wedge or raise Wedged instead. Not all wedges can be detected.
Watch the order in which locks are acquired! Procedure trusts in caller using correct locking order.
CallWithLocks: PROC [proc: PROC, tq1, tq2: TQ];
Executes proc with locks of both TQ`s hold in the right order. Caller MUST NOT hold lock of either TQ (otherwise it is too hard to make predictable statements about wedging). Might have to wait until lock is free. Order of execution of different calls or with queued procs is undefined.
Might wedge or raise an ERROR instead. Not all wedges can be detected.
Watch the order of locks acquired otherwise!
OwnsLock: PROC [tq: TQ] RETURNS [BOOL];
Returns whether caller currently holds TQ's lock.
GetLockOrder: PROC [first, second: TQ] RETURNS [LockOrder];
Returns whether it is ok to get first's lock before getting second's lock.
LockOrder: TYPE ~ {ok, reversed, dead};
GetLockOrderNum: PROC [tq: TQ] RETURNS [INT];
Returns value used for order. (Some application want a predefined classes for locking order, so they need this procedure to check it.)
Match: TYPE ~ REF MatchRep;
The basic type used to decide what handler should be called to handle particular events.
MatchList: TYPE ~ LIST OF Match;
MatchRep: TYPE ~ RECORD [proc: EventProcType, handles: EventFilter, tq: TQ ¬ NIL, data: REF ¬ NIL];
Describes: if event described by "handles" occures, it should be queued on "tq"
"data" is passed throu to event handler procedure
Window access
Window related types
WindowClass: TYPE ~ MACHINE DEPENDENT {copyFromParent, inputOutput, inputOnly};
BackingStore: TYPE ~ MACHINE DEPENDENT {notUseful, whenMapped, always, illegal};
MapState: TYPE ~ MACHINE DEPENDENT {unmapped, unviewable, viewable};
BitGravity: TYPE ~ MACHINE DEPENDENT {forget(0), northWest(1), north(2), northEast(3), west(4), center(5), east(6), southWest(7), south(8), southEast(9), static(10), illegal(11) };
WinGravity: TYPE ~ MACHINE DEPENDENT {unmap(0), northWest(1), north(2), northEast(3), west(4), center(5), east(6), southWest(7), south(8), southEast(9), static(10), illegal(11) };
BitmapFormat: TYPE ~ MACHINE DEPENDENT {bitmap, xyPixmap, zPixmap};
PixmapFormat: TYPE ~ BitmapFormat[xyPixmap..zPixmap];
StackModeExtra: TYPE ~ MACHINE DEPENDENT {above, below, topIf, bottomIf, opposite, dontChange};
StackMode: TYPE ~ StackModeExtra[above..opposite];
Window set up
illegalDrawable: Drawable ~ [LAST[CARD32]];
illegalPixmap: Pixmap ~ [illegalDrawable];
illegalPixel: Pixel ~ LAST[CARD32];
illegalColorMap: ColorMap ~ [LAST[CARD32]];
illegalCursor: Cursor ~ [LAST[CARD32]];
undefinedBackingPlanes: CARD32 ~ LAST[CARD32];
BOOL3: TYPE ~ MACHINE DEPENDENT {false, true, illegal};
IllegalPixmap: PROC [p: Pixmap] RETURNS [BOOL]
~ INLINE {RETURN [p=illegalPixmap]};
IllegalColorMap: PROC [cm: ColorMap] RETURNS [BOOL]
~ INLINE {RETURN [cm=illegalColorMap]};
IllegalCursor: PROC [c: Cursor] RETURNS [BOOL]
~ INLINE {RETURN [c=illegalCursor]};
Attributes: TYPE ~ RECORD [
Type describes attributes to be applied; it is not used for querying attributes.
Restriction on event-mask attribute: certain events, necessary for internal consistency can not be excluded from beeing generated
backgroundPixmap: Pixmap ¬ illegalPixmap,
backgroundPixel: Pixel ¬ illegalPixel,
borderPixmap: Pixmap ¬ illegalPixmap,
borderPixel: Pixel ¬ illegalPixel,
bitGravity: BitGravity ¬ illegal,
winGravity: WinGravity ¬ illegal,
backingStore: BackingStore ¬ illegal,
backingPlanes: CARD32 ¬ undefinedBackingPlanes,
backingPixel: Pixel ¬ illegalPixel,
overrideRedirect: BOOL3 ¬ illegal,
saveUnder: BOOL3 ¬ illegal,
eventMask: SetOfEvent ¬ unspecifiedEvents,
doNotPropagateMask: SetOfEvent ¬ unspecifiedEvents,
colorMap: ColorMap ¬ illegalColorMap,
cursor: Cursor ¬ illegalCursor
];
MergeAttributes: PROC [win, loose: Attributes] RETURNS [Attributes];
merges attributes; if value in both inputs is defined, the value in "win" will win,
except eventMask which is OR'ed
CreateWindow: PROC [c: Connection, matchList: MatchList, parent: Window ¬ nullWindow, geometry: Geometry ¬ [], class: WindowClass ¬ copyFromParent, visual: Visual ¬ nullVisual, depth: INTEGER ¬ -1, attributes: Attributes ¬ [], details: Details ¬ NIL] RETURNS [Window];
Creates a window...
matchList: events to be matched and called.
pos: upper left corner (outside of border)
size: inner size excluding border
Caller should enable events [in attributes.eventMask] he wants to handle with matchList. Those events can not be disabled with ChangeWindowAttributes.
ChangeWindowAttributes: PROC [c: Connection, window: Window, attributes: Attributes, details: Details ¬ NIL];
Warning:
Events enabled with CreateWindow or MatchList's can not be disabled.
Be carefull with this procedure, as there is no arbitration what application enables what event.
AddDispatch: PROC [c: Connection, window: Window, match: Match, generate: SetOfEvent ¬ unspecifiedEvents, details: Details ¬ NIL];
Add an event handlers for events on window.
match: events to be matched and called.
generate: Events the server ought to generate.
This is not an original X-feature, but it may generate (ChangeWindowAttributes) requests to the server.
DestroyWindow: PROC [c: Connection, window: Window, details: Details ¬ NIL];
DestroySubWindows: PROC [c: Connection, window: Window, details: Details ¬ NIL];
MapWindow: PROC [c: Connection, window: Window, details: Details ¬ NIL];
MapSubWindows: PROC [c: Connection, window: Window, details: Details ¬ NIL];
UnmapWindow: PROC [c: Connection, window: Window, details: Details ¬ NIL];
UnmapSubWindows: PROC [c: Connection, window: Window, details: Details ¬ NIL];
ConfigureWindow: PROC [c: Connection, window: Window, geometry: Geometry ¬ [], sibling: Window ¬ nullWindow, stackMode: StackModeExtra ¬ dontChange, details: Details ¬ NIL];
Defaulting a values means: don't change current value
ReparentWindow: PROC [c: Connection, window: Window, newParent: Window, pos: Point, details: Details ¬ NIL];
CirculateWindow: PROC [c: Connection, window: Window, direction: CirculateDirection, details: Details ¬ NIL];
CirculateDirection: TYPE ~ MACHINE DEPENDENT {raiseLowest, lowerHighest};
Window queries
QueryTree: PROC [c: Connection, window: Window] RETURNS [treeInfo: REF TreeInfoRec];
TreeInfoRec: TYPE ~ RECORD [
root: Window,
parent: Window,
children: SEQUENCE leng: NAT OF Window
];
GetGeometry: PROC [c: Connection, drawable: Drawable] RETURNS [GeometryRec];
GeometryRec: TYPE ~ RECORD [
root: Window,
depth: BYTE,
geometry: Geometry ¬ nullGeometry
];
GetWindowAttributes: PROC [c: Connection, window: Window] RETURNS [rat: RepliedAttributes];
RepliedAttributes: TYPE ~ RECORD [
Type returned on querying attributes of a window; not used for setting attributes.
backingStore: BackingStore,
visual: Visual,
class: WindowClass[inputOutput..inputOnly],
bitGravity: BitGravity,
winGravity: WinGravity,
backingPlanes: CARD32,
backingPixel: Pixel,
saveUnder: BOOL,
isInstalled: BOOL,
mapState: MapState,
overrideRedirect: BOOL,
colorMap: ColorMap, -- ¬ nullColorMap
allEventMask: SetOfEvent,
yourEventMask: SetOfEvent,
doNotPropagateMask: SetOfEvent
];
QueryScreen: PROC [c: Connection, drawable: Drawable] RETURNS [Screen];
Finds screen of window; might produce requests to X server or might be cached.
Not an original X request.
QueryScreenDepth: PROC [c: Connection, drawable: Drawable] RETURNS [depth: ScreenDepth];
Finds screen and depth; might produce requests to X server or might be cached.
Not an original X request.
TranslateCoordinates: PROC [c: Connection, srcWindow, dstWindow: Window, srcPos: Point] RETURNS [TranslateRec];
TranslateRec: TYPE ~ RECORD [sameScreen: BOOL, child: Window, pos: Point];
Cursors and pixmaps
CreateCursor: PROC [c: Connection, source: Pixmap, mask: Pixmap ¬ nullPixmap, hotP: Point, foreground: REF READONLY RGBRec ¬ black, background: REF READONLY RGBRec ¬ white, details: Details ¬ NIL] RETURNS [cursor: Cursor];
CreateGlyphCursor: PROC [c: Connection, sourceFont: Font, maskFont: Font ¬ nullFont, sourceChar: CARD16, maskChar: CARD16 ¬ 0, foreground: REF READONLY RGBRec ¬ black, background: REF READONLY RGBRec ¬ white, details: Details ¬ NIL] RETURNS [cursor: Cursor];
ReColorCursor: PROC [c: Connection, cursor: Cursor, foreground: REF READONLY RGBRec ¬ black, background: REF READONLY RGBRec ¬ white, details: Details ¬ NIL];
FreeCursor: PROC [c: Connection, cursor: Cursor, details: Details ¬ NIL];
CreatePixmap: PROC [c: Connection, drawable: Drawable ¬ nullDrawable, size: Size, depth: BYTE, details: Details ¬ NIL] RETURNS [Pixmap];
FreePixmap: PROC [c: Connection, pixmap: Pixmap, details: Details ¬ NIL];
Fonts
IsFont: PROC [x: REF ANY] RETURNS [BOOL];
NarrowFont: PROC [x: REF ANY] RETURNS [Font];
OpenFont: PROC [c: Connection, name: ROPE, details: Details ¬ NIL] RETURNS [font: Font];
Get font; might do server request or return cached font.
Details are only useful in case of a server request.
PreventGcOnServer: PROC [font: Font];
Resource won't be freed up until connection closes down
GetFontPath: PROC [c: Connection] RETURNS [LIST OF ROPE];
CharInfoSequence: TYPE ~ RECORD [SEQUENCE size: NAT OF CharInfoRec];
CharInfoRec: TYPE ~ PACKED RECORD [
leftBearing: INT16,
rightBearing: INT16,
charWidth: INT16,
ascent: INT16,
descent: INT16,
attributes: CARD16
];
FontPropSequence: TYPE ~ RECORD [SEQUENCE size: NAT OF FontPropRec];
FontPropRec: TYPE ~ RECORD [
name: XAtom,
value: CARD32
];
DrawDirection: TYPE ~ MACHINE DEPENDENT {leftToRight, rightToLeft};
QueryFont: PROC [c: Connection, font: Fontable] RETURNS [REF READONLY FontInfoRec];
Avoids calling the server if font information is cached
FontInfoRec: TYPE ~ RECORD [
minBounds: REF READONLY CharInfoRec,
maxBounds: CharInfoRec,
minCharOrByte2: CARD,
maxCharOrByte2: CARD,
defaultChar: CARD16,
drawDirection: DrawDirection,
minByte1: INT,
maxByte1: INT,
allCharsExist: BOOL,
fontAscent: INT,
fontDescent: INT,
properties: REF READONLY FontPropSequence,
charInfos: REF READONLY CharInfoSequence
];
QueryTextExtents: PROC [c: Connection, font: Fontable, r: ROPE] RETURNS [TextExtentsRec];
QueryTextExtents16: PROC [c: Connection, font: Fontable, s: String16] RETURNS [TextExtentsRec];
Avoids calling the server if font information is cached
TextExtentsRec: TYPE ~ RECORD [
drawDirection: DrawDirection,
fontAscent: INT,
fontDescent: INT,
overallAscent: INT,
overallDescent: INT,
overallWidth: INT,
overallLeft: INT,
overallRight: INT
];
ListFonts: PROC [c: Connection, each: NameProc, pattern: ROPE, maxNames: NAT ¬ 40, data: REF ¬ NIL];
Gets up to maxNames font names from the server.
data is passed through to each. If each returns quit=TRUE it will not be called anymore with more fonts. This saves doing procedure calls, but the server did already send all the font names.
NameProc: TYPE ~ PROC [name: ROPE, data: REF] RETURNS [quit: BOOL ¬ FALSE];
ListFontsWithInfo: PROC [c: Connection, each: FontInfoProc, pattern: ROPE, maxNames: NAT, data: REF ¬ NIL] RETURNS [count: INT];
Enumerates fonts which match pattern, including some information.
each is a callback to return results. If each returns quit=TRUE it will not be called anymore with more fonts. This saves doing procedure calls, but it does NOT prevent the X server from sending information for the remaining fonts.
data is passed through to each.
count is the actual number of font infos returned by the server
FontInfoProc: TYPE ~ PROC [name: Rope.ROPE, info: REF FontInfoRec, data: REF] RETURNS [quit: BOOL ¬ FALSE];
Procedure to return result of ListFontsWithInfo request.
The per character metrics (info.charInfos) is not available.
Pointer
GetPointerMapping: PUBLIC PROC [c: Connection] RETURNS [pointerMapping: PointerMapping];
cached
PointerMapping: TYPE ~ REF READONLY PointerMappingSequence;
PointerMappingSequence: TYPE ~ RECORD [SEQUENCE leng: NAT OF BYTE];
--nominal mapping: map[i]=i
--index 0 unused
GrabPointer: PROC [c: Connection, window: Window, ownerEvents: BOOL, eventMask: SetOfPointerEvent, pointerMode: Synchronicity ¬ asynchronous, keyboardMode: Synchronicity ¬ asynchronous, confine: Window ¬ nullWindow, cursor: Cursor ¬ nullCursor, timeStamp: TimeStamp] RETURNS [status: GrabStatus];
Actively grabs control of the pointer.
May time out if after some seconds no mouse key is down. Time-out is considered a client error and must be avoided.
See remarks on "GrabServer" request about timing.
UngrabPointer: PROC [c: Connection, timeStamp: TimeStamp, details: Details ¬ NIL];
Defaulting details causes a flush
ChangeActivePointerGrab: PROC [c: Connection, eventMask: SetOfPointerEvent, cursor: Cursor ¬ nullCursor, timeStamp: TimeStamp, details: Details ¬ NIL];
GrabButton: PROC [c: Connection, grabWindow: Window, confineWindow: Window ¬ nullWindow, modifiers: SetOfKeyButMask ¬ [anyModfier: TRUE], button: BYTE ¬ 0, ownerEvents: BOOL, eventMask: SetOfPointerEvent, pointerMode: Synchronicity, keyboardMode: Synchronicity, cursor: Cursor ¬ nullCursor, details: Details ¬ NIL];
Establishes a passive grab.
UngrabButton: PROC [c: Connection, window: Window, modifiers: SetOfKeyButMask ¬ [anyModfier: TRUE], button: BYTE ¬ 0, details: Details ¬ NIL];
QueryPointer: PROC [c: Connection, window: Window ¬ nullWindow] RETURNS [PointerReply];
PointerReply: TYPE ~ RECORD [
root: Window,
child: Window, --or nullWindow
rootP: Point,
pos: Point,
mask: SetOfKeyButMask,
sameScreen: BOOL
];
WarpPointer: PROC [c: Connection, dstWindow: Window ¬ nullWindow, dstPos: Point ¬ [0, 0], srcWindow: Window ¬ nullWindow, srcPos: Point ¬ [0, 0], srcSize: Size ¬ [0, 0], details: Details ¬ NIL];
GetMotionEvents: PROC [c: Connection, window: Window, start, stop: TimeStamp] RETURNS [REF TimeCoords];
TimeCoord: TYPE ~ RECORD [time: TimeStamp, p: Point];
TimeCoords: TYPE ~ RECORD [SEQUENCE size: NAT OF TimeCoord];
QueryBestSize: PROC [c: Connection, class: BestSizeClass, drawable: Drawable, size: Size] RETURNS [Size];
BestSizeClass: TYPE ~ MACHINE DEPENDENT {cursor, tile, stipple};
Grab "ownership" convention.
This is a Cedar convention and not defined by the standard X protocol. Since in Cedar usage connections often are shared between independent applications the original X ownerEvents or OwnerGrabButton mask can not reasonably select what windows should be notified on events. This convention allows to actively establish an ownership of (button) grabs, so events can be ignored if they were ment for an other application.
The (button) grab ownership must be established if a grab is made which does not guarantee exclusive events; e.g when ownerEvents is true or OwnerGrabButton is set. The grab ownership can at any time be taken away by an other application.
The (button) grab ownership must be checked before acting on events. An application has no way to know whether this precaution is necessary or not, because in Cedar this depends on independent other applications.
ButtonGrabOwner: PROC [c: Connection] RETURNS [REF] ~ INLINE {RETURN [c.buttonGrabOwner]};
Cedar convention; not standard X protocol
Returns "owner" of grab or NIL if none; events owned by other clients might be ignored.
SetButtonGrabOwner: PROC [c: Connection, timeStamp: TimeStamp, value: REF] RETURNS [success: SetGrabOwnerSuccess];
Cedar convention; not standard X protocol.
Establishes (button) grab "ownership".
Overwrites any grab ownership established before timeStamp.
Fails if grab ownership has already been established at or later then timeStamp or if timeStamp lays in future.
Clients grabbing with ownerEvents true OwnerGrabButton set must establish a grab owner.
SetGrabOwnerSuccess: TYPE ~ {failedFutureTime, failedLaterTime, failedEqualTime, succeeded};
ClearButtonGrabOwner: PROC [c: Connection, timeStamp: TimeStamp];
Cedar convention; not standard X protocol.
Removes grab ownership if it was established at timestamp or before.
Noop if grab ownership was established after timeStamp.
Keyboard
Keyboard mapping and state
KeyBut: TYPE ~ XlKeyBut.KeyBut;
SetOfKeyButMask: TYPE ~ XlKeyBut.SetOfKeyButMask;
SetOfKeyMask: TYPE ~ XlKeyBut.SetOfKeyMask;
ORSetOfKeyButMask: PROC [s1, s2: SetOfKeyButMask] RETURNS [SetOfKeyButMask] ~ INLINE {
RETURN [XlKeyBut.ORSetOfKeyButMask[s1, s2]];
};
IncludeKeyButInSet: PROC [keyBut: KeyBut, mask: SetOfKeyButMask ¬ []] RETURNS [SetOfKeyButMask] ~ INLINE {
RETURN [XlKeyBut.IncludeKeyButInSet[keyBut, mask]]
};
IsKeyButInSet: PROC [keyBut: KeyBut, mask: SetOfKeyButMask] RETURNS [BOOL] ~ INLINE {
RETURN [XlKeyBut.IsKeyButInSet[keyBut, mask]]
};
KeyCode: TYPE ~ KeyTypes.KeyCode;
A machine [and time] dependent identification of a key.
The X protocol restricts values to [8..255] however Xl does not.
KeySym: TYPE ~ KeyTypes.KeySym;
An identification which refers (roughly) to the engravings found on the keycaps of keyboards key engravings.
noSym: KeySym ~ [0];
KeyboardMapping: TYPE ~ KeyMappingTypes.Mapping;
To make sure a mapping is used which is not to old, clients could get the mapping change notification in the same thread as the key/pointer events [mapping change notification happens on 0 window].
If QueryKeymap is used, no protection against using a mapping which is more recent than a key/pointer event can be given. [Even if a new mapping would be requested immediately [monitored] after each mapping change notification, X would not prevent another connection from changing the mapping and racing ahead before the first map request finishes]
GetKeyboardMapping: PROC [c: Connection] RETURNS [KeyboardMapping];
Cached; cache access is fast enough to be used for every keystroke.
The original X request allows to request partial ranges, but for Cedar this seems not necessary and would hinder caching. Use an extras interface if exact protocol behaviour is required. In addition to the protocol, this mapping is also augmented with entries for buttons. (The button entries are are to be applied after the button map is applied; this ensures buttons do not conflict with KeyCodes.)
Use the KeyMapping interface for inpecting the mapping.
GetModifierMapping: PROC [c: Connection] RETURNS [modifierMapping: ModifierMapping];
Cached
Modifier: TYPE ~ KeyBut[shift..mod5];
ModifierMappingSequence: TYPE ~ RECORD [SEQUENCE num: NAT OF ARRAY Modifier OF KeyCode];
ModifierMapping: TYPE ~ REF READONLY ModifierMappingSequence;
KeyboardState: TYPE ~ KeyStateTypes.KeyboardState;
QueryKeymap: PROC [c: Connection, reUse: REF KeyboardState ¬ NIL] RETURNS [REF KeyboardState];
Grabbing keyboard
GrabKeyboard: PROC [c: Connection, grabWindow: Window, ownerEvents: BOOL, pointerMode: Synchronicity, keyboardMode: Synchronicity, time: TimeStamp] RETURNS [status: GrabStatus];
See remarks on "GrabServer" request about timing
Avoid synchrounous pointerMode [wedge protection not yet implemented]
UngrabKeyboard: PROC [c: Connection, time: TimeStamp, details: Details ¬ NIL];
Defaulting details causes a flush
ForcedUngrabKeyboard: PROC [c: Connection];
NOT a standard X request; ungrabs keyboard even if grabbed by different Cedar connection
[UngrabKeyboard, faking the identity of the Connection which actually did the grab]
...If that connection is not wedged and allows doing it... [time's out if doesn't come through]
Heavy weight, success highly probable if keyboard was grabbed by a connection from same Cedar world, but not guaranteed.
GrabKey: PROC [c: Connection, grabWindow: Window, modifiers: SetOfKeyButMask ¬ [anyModfier: TRUE], key: KeyCode ¬ anyKey, ownerEvents: BOOL, pointerMode: Synchronicity, keyboardMode: Synchronicity, details: Details ¬ NIL];
Installs passive grab on keyboard
anyKey: KeyCode ~ keycode0;
UngrabKey: PROC [c: Connection, window: Window, modifiers: SetOfKeyButMask ¬ [anyModfier: TRUE], key: KeyCode ¬ anyKey, details: Details ¬ NIL];
Other devices
Bell: PROC [c: Connection, percent: INT ¬ 0, details: Details ¬ NIL];
Selections
SetSelectionOwner: PROC [c: Connection, owner: Window ¬ nullWindow, selection: XAtom, time: TimeStamp, details: Details ¬ NIL];
ICCCM Convention: do not use currentTime for time [although X protocol allows]
ICCCM Convention: Use GetSelectionOwner to verify success
GetSelectionOwner: PROC [c: Connection, selection: XAtom] RETURNS [owner: Window ¬ nullWindow];
ConvertSelection: PROC [c: Connection, requestor: Window, selection: XAtom, target: XAtom, property: XAtom, time: TimeStamp, details: Details ¬ NIL];
ICCCM Convention: do not use currentTime for time [although X protocol allows]
ICCCM Convention: do not use [0] for property [although X protocol allows]
SendSelectionNotifyEvent: PROC [c: Connection, destination: Window, selection: XAtom, target: XAtom, property: XAtom ¬ [0], timeStamp: TimeStamp, details: Details ¬ NIL];
Shortcut for send-event with empty set for event-mask.
Input focus
FocusReversion: TYPE ~ MACHINE DEPENDENT {none, pointerRoot, parent};
focusPointerRoot: Window ~ [[1]];
SetInputFocus: PROC [c: Connection, window: Window ¬ nullWindow, revertTo: FocusReversion ¬ parent, timeStamp: TimeStamp, details: Details ¬ NIL];
window one of regular window, nullWindow or focusPointerRoot
ICCCM Convention: do not use currentTime for timeStamp [although X protocol allows]
GetInputFocus: PUBLIC PROC [c: Connection] RETURNS [window: Window ¬ nullWindow, revertTo: FocusReversion];
window one of regular window, nullWindow or focusPointerRoot
Graphics
Graphics context
GContext: TYPE ~ REF GContextRep;
This type matches the X graphical context insofar as it has the same expressiveness. However, it is cached on the client side and actually moved to the server only when needed.
Sharing graphics context among different connections is a bad idea.
Access to GContext is NOT monitored (since it wont be shared anyway).
IsGContext: PROC [x: REF ANY] RETURNS [BOOL];
NarrowGContext: PROC [x: REF ANY] RETURNS [GContext];
GCFunction: TYPE ~ MACHINE DEPENDENT {clear, and, andReverse, copy, andInverted, noop, xor, or, nor, equiv, invert, orReverse, copyInverted, orInverted, nand, set};
GCLineStyle: TYPE ~ MACHINE DEPENDENT {solid, onOffDash, doubleDash};
GCCapStyle: TYPE ~ MACHINE DEPENDENT {notLast, butt, round, projecting};
GCJoinStyle: TYPE ~ MACHINE DEPENDENT {miter, round, bevel};
GCFillStyle: TYPE ~ MACHINE DEPENDENT {solid, tiled, stippled, opaqueStippled};
GCFillRule: TYPE ~ MACHINE DEPENDENT {evenOdd, winding};
GCArcMode: TYPE ~ MACHINE DEPENDENT {chord, pieSlice};
GCSubWindowMode: TYPE ~ MACHINE DEPENDENT {clipByChildren, includeInferiors};
MakeGContext: PROC [c: Connection, drawable: Drawable ¬ nullDrawable] RETURNS [gc: GContext];
Delayed until gc is actually used.
If gc is exported or any chance exist that it is used over a different connections [shame on you], it should be flushed explicitely once after creation. This prevents the actual creation of the resource on the server side from using two connection locks.
The gc can be used with any destination drawable having the same root and depth as the specified drawable; for a defaulted drawable the information is taken from first usage [discouraged].
Note that the defaults for foreground and background are counter intuitive [X Protocol].
All SetGCfoo procs are delayed until gc is actually used
SetGCFunction: PROC [gc: GContext, function: GCFunction];
SetGCPlaneMask: PROC [gc: GContext, planeMask: CARD32];
SetGCForeground: PROC [gc: GContext, foreground: CARD32];
SetGCBackground: PROC [gc: GContext, background: CARD32];
SetGCGrounds: PROC [gc: GContext, foreground, background: CARD32];
SetGCLineWidth: PROC [gc: GContext, width: INT];
SetGCLineStyle: PROC [gc: GContext, lineStyle: GCLineStyle];
SetGCCapStyle: PROC [gc: GContext, capStyle: GCCapStyle];
SetGCJoinStyle: PROC [gc: GContext, joinStyle: GCJoinStyle];
SetGCFillStyle: PROC [gc: GContext, fillStyle: GCFillStyle];
SetGCFillRule: PROC [gc: GContext, fillRule: GCFillRule];
SetGCArcMode: PROC [gc: GContext, arcMode: GCArcMode];
SetGCTile: PROC [gc: GContext, tile: Pixmap];
SetGCStipple: PROC [gc: GContext, stipple: Pixmap];
SetGCStippleOrigin: PROC [gc: GContext, origin: Point];
SetGCFont: PROC [gc: GContext, font: Font];
SetGCSubWindowMode: PROC [gc: GContext, subwindowMode: GCSubWindowMode];
SetGCGraphicsExposures: PROC [gc: GContext, graphicsExposures: BOOL];
SetGCClipMaskOrigin: PROC [gc: GContext, origin: Point];
SetGCClipMask: PROC [gc: GContext, clipMask: Pixmap ¬ nullPixmap --no clip--];
SetGCDashOffset: PROC [gc: GContext, offset: CARD16];--not the SetDashes protocol request
SetGCDashes: PROC [gc: GContext, dashes: BYTE];--not the SetDashes protocol request
Graphics context and drawing requests
SetDashes: PROC [c: Connection, gc: GContext, dashOffset: CARD16, dashes: LIST OF BYTE, details: Details ¬ NIL];
SetClipRectangles: PROC [c: Connection, gc: GContext, clipOrigin: Point ¬ [0, 0], rects: PackedRects, ordering: Ordering ¬ unSorted, start: NAT ¬ 0, number: NAT ¬ LAST[NAT], details: Details ¬ NIL] RETURNS [ok: BOOL];
ok: number of rectangles does not excede maximum request length
if not ok some rectangles are ignored
Ordering: TYPE ~ MACHINE DEPENDENT {unSorted, ySorted, yxSorted, yxBanded};
ClearArea: PROC [c: Connection, window: Window, pos: Point, size: Size, exposures: BOOL ¬ FALSE, details: Details ¬ NIL];
CopyArea: PROC [c: Connection, src, dst: Drawable, srcP, dstP: Point, size: Size, gc: GContext, details: Details ¬ NIL];
CopyPlane: PROC [c: Connection, src, dst: Drawable, srcP, dstP: Point, size: Size, gc: GContext, bitPlane: CARD, details: Details ¬ NIL];
FillRectangle: PROC [c: Connection, drawable: Drawable, gc: GContext, pos: Point, size: Size, details: Details ¬ NIL];
A simplified PolyFillRectangle request
PolyFillRectangle: PROC [c: Connection, drawable: Drawable, gc: GContext, rects: PackedRects, start: NAT ¬ 0, number: NAT ¬ LAST[NAT], details: Details ¬ NIL];
DrawLine: PROC [c: Connection, drawable: Drawable, p1, p2: Point, gc: GContext, details: Details ¬ NIL];
A simplified PolyLine request
PutImage: PROC [c: Connection, drawable: Drawable, gc: GContext, size: Size, dest: Point, base: LONG POINTER, offx: INT, offy: INT, scanLineBytes: INT, bitsPerPixel: NAT ¬ 1, details: Details ¬ NIL];
"bit-blit" of area. X PutImage request; generalized to have arbitrary offx, offy.
The area is clipped in the destination drawable, but must fit completely in the source bitmap.
This might generate multiple X requests to draw individual pieces of the area.
dest: dest for area (inside drawable)
offx, offy: source of area (in bitmap coordinates)
size: size of area moved
base: base of bitmap; assume: [slow: down, fast: right]
scanLineBytes: bytes per scanline in bitmap (on X client; NOT X server)
RESTRICTIONS:
Assumes depth=bitsPerPixel.
Assumes bitmapFormat := IF bitsPerPixel=1 THEN bitmap ELSE zPixmap
GetImage: PROC [c: Connection, drawable: Drawable, pos: Point, size: Size, format: PixmapFormat, planeMask: CARD32 ¬ LAST[CARD32]] RETURNS [GetImageReplyRec];
Fancy request; read the X Protocol before using
GetImageReplyRef: TYPE ~ REF GetImageReplyRec;
GetImageReplyRec: TYPE ~ RECORD [
depth: BYTE,
visual: Visual,
base: LONG POINTER, --may point into middle of object
byteCount: INT, --of this piece; check "next" to see for more pieces
anchor: REF, --keep on to prevent garbage collection
next: GetImageReplyRef ¬ NIL --continuation in case of too many bytes
];
Text drawing requests
String16: TYPE ~ RECORD [s: ROPE];
RopeToString16: PROC [r: ROPE] RETURNS [String16];
ImageChar: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, ch: CHAR, details: Details ¬ NIL];
Conveniance procedure [like ImageRope]
ImageText8 request
Draws character and background
ImageRope: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, r: ROPE, details: Details ¬ NIL];
ImageText8 request
Draws rope and background
ImageString16: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, s: String16, details: Details ¬ NIL];
ImageText16 request
Draws string16 and background
PolyText8: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, deliver: Text8DeliverProc, data: REF ¬ NIL, details: Details ¬ NIL];
PolyText8 request. Calls deliver to return textitems or font changes. data is handed to deliver.
Text8DeliverProc: TYPE ~ PROC [data: REF] RETURNS [newFont: Font ¬ NIL, delta: INT ¬ 0, text: Rope.ROPE, startPos: INT ¬ 0, length: INT ¬ LAST[INT], more: BOOL ¬ FALSE];
DrawChar: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, ch: CHAR, delta: INT ¬ 0, details: Details ¬ NIL];
Simpler PolyText8 request
Draws character without background
DrawRope: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, r: ROPE, delta: INT ¬ 0, details: Details ¬ NIL];
Simpler PolyText8 request [1 item]
Draws rope without background
DrawString16: PROC [c: Connection, drawable: Drawable, pos: Point, gc: GContext, s: String16, delta: INT ¬ 0, details: Details ¬ NIL];
Simple PolyText16 request [1 item]
Draws string16 without background
I'm to lazy to provide PolyText16, but there would be no problem if somebody needs it.
Color
RGBVal: TYPE ~ CARD16;
RGBRec: TYPE ~ RECORD [
red, green, blue: RGBVal
];
white: READONLY REF READONLY RGBRec;
black: READONLY REF READONLY RGBRec;
CreateColorMap: PROC [c: Connection, visual: Visual, window: Window, allocAll: BOOL ¬ FALSE, details: Details ¬ NIL] RETURNS [ColorMap];
FreeColorMap: PROC [c: Connection, colorMap: ColorMap, details: Details ¬ NIL];
CopyColorMapAndFree: PROC [c: Connection, free: ColorMap, details: Details ¬ NIL] RETURNS [ColorMap];
InstallColorMap: PROC [c: Connection, colorMap: ColorMap, details: Details ¬ NIL];
UnInstallColorMap: PROC [c: Connection, colorMap: ColorMap, details: Details ¬ NIL];
ListInstalledColorMaps: PROC [c: Connection, window: Window] RETURNS [REF READONLY ColorMaps];
ColorMaps: TYPE ~ RECORD [SEQUENCE count: NAT OF ColorMap];
AllocColor: PROC [c: Connection, colorMap: ColorMap, color: RGBRec] RETURNS [pixel: Pixel, usedColor: RGBRec];
AllocNamedColor: PROC [c: Connection, colorMap: ColorMap, name: ROPE] RETURNS [pixel: Pixel, exactColor, usedColor: RGBRec];
AllocColorCells: PROC [c: Connection, colorMap: ColorMap, colors, planes: CARD16, contiguos: BOOL¬FALSE] RETURNS [pixels: REF Card32Sequence, masks: REF Card32Sequence];
AllocColorPlanes: PROC [c: Connection, colorMap: ColorMap, colors, reds, greens, blues: CARD16, contiguos: BOOL¬FALSE] RETURNS [pixels: REF Card32Sequence, redMask, greenMask, blueMask: CARD32];
FreeColors: PROC [c: Connection, colorMap: ColorMap, pixels: LIST OF CARD32, planeMask: CARD32, details: Details ¬ NIL];
StoreColors: PROC [c: Connection, colorMap: ColorMap, items: LIST OF ColorItem, details: Details ¬ NIL];
ColorItem: TYPE ~ RECORD [pixel: Pixel, doRed, doGreen, doBlue: BOOL ¬ TRUE, rgb: RGBRec];
StoreNamedColor: PROC [c: Connection, colorMap: ColorMap, pixel: Pixel, name: ROPE, doRed, doGreen, doBlue: BOOL, details: Details ¬ NIL];
QueryColors: PROC [c: Connection, colorMap: ColorMap, pixels: LIST OF CARD32] RETURNS [LIST OF RGBRec];
LookupColor: PROC [c: Connection, colorMap: ColorMap, name: ROPE] RETURNS [exact, used: RGBRec];
Event handling
EventCode: TYPE ~
MACHINE DEPENDENT { local(0), errorNotify(1), keyPress(2), keyRelease(3), buttonPress(4), buttonRelease(5), motionNotify(6), enterNotify(7), leaveNotify(8), focusIn(9), focusOut(10), keymapNotify(11), expose(12), graphicsExposure(13), noExposure(14), visibilityNotify(15), createNotify(16), destroyNotify(17), unmapNotify(18), mapNotify(19), mapRequest(20), reparentNotify(21), configureNotify(22), configureRequest(23), gravityNotify(24), resizeRequest(25), circulateNotify(26), circulateRequest(27), propertyNotify(28), selectionClear(29), selectionRequest(30), selectionNotify(31), colorMapNotify(32), clientMessage(33), mappingNotify(34), extension, finalEvent, tipEvent, replyEvent };
keyPress..mappingNotify are core events of the standard X protocol.
All other events are NOT part of the standard X protocol or changed somehow.
local is used for requests not initiated through X.
finalEvent is a notification that the connection died or was closed.
tipEvent is reserved for implementation of tip tables.
replyEvent is reserved.
extension is used instead of ENDCASE branch of variant records for extensions to X.
errorNotify need not be the original error reply of X.
SetEventCodes: PROC [list: LIST OF EventCode] RETURNS [EventCodes];
conveniant procedure to make a mask
EventCodeRope: PROC [code: EventCode] RETURNS [r: ROPE];
debugging aid
EventProcType: TYPE ~ PROC [event: Event, clientData: REF, tq: TQ];
Type of procedure which handles events.
clientData: is client data of match.
Do not change priority. Process is reused!
EventFilter: TYPE ~ REF EventFilterRec;
The EventFilter type describes the event types some procedure is ready to accept.
EventCodes: TYPE ~ PACKED ARRAY EventCode[EventCode.FIRST..EventCode.LAST] OF BOOL ¬ ALL[FALSE];
Used to describe the set of core events a procedure wants to accept.
Distinguish the set of events to handle from the set of events generated by X server.
CreateEventFilter: PROC [c1, c2, c3, c4: EventCode ¬ extension] RETURNS [filter: EventFilter];
Create a simple event filter (filtering basic events only; explicitely no extensions)
FullCreateEventFilter: PROC [eventCodes: LIST OF EventCode ¬ NIL, activate: EventCodes ¬ ALL[FALSE], extensions: LIST OF REF ANY ¬ NIL] RETURNS [filter: EventFilter];
Create a complex event filter
PropertyNotifyState: TYPE ~ MACHINE DEPENDENT {newValue, deleted};
MappingNotifyKind: TYPE ~ MACHINE DEPENDENT {modifier, keyboard, pointer};
FocusDetail: TYPE ~ MACHINE DEPENDENT {ancestor, virtual, inferior, nonlinear, nonlinearVirtual, Pointer, PointerRoot, None};
EnterLeaveDetail: TYPE ~ FocusDetail[ancestor..nonlinearVirtual];
GrabMode: TYPE ~ MACHINE DEPENDENT {normal, grab, ungrab, whileGrabbed};
Visibility: TYPE ~ MACHINE DEPENDENT {unobscured, partiallyObscured, fullyObscured};
Place: TYPE ~ MACHINE DEPENDENT {top, bottom};
NormalHint: TYPE ~ MACHINE DEPENDENT {normal(0), hint(1)};
Event: TYPE ~ REF READONLY EventRep;
EventRep: TYPE ~ RECORD [
originalCodeByte: BYTE ¬ ORD[EventCode[local]],
dispatchDrawable: Drawable ¬ nullDrawable,
connection: Connection ¬ NIL,
The connection making the event; no ownership claim.
Defined in case of event coming from the server.
props: <<PRIVATE>> REF ¬ NIL,
details: SELECT type: EventCode FROM
local => [who, key, data: REF], --event was not passed through an X server
errorNotify => [ --this need not be the original X error event;
--Errors can not be matched the standard way
explanation: ROPE ¬ NIL,
errorKind: ErrorKind ¬ nil,
serverGenerated: BOOL ¬ FALSE,
--if serverGenerated the X protocol explains what went wrong
--if not serverGenerated this is added functionality by Xl
seq: SequenceNo, --sequence, connection and other field not always initialized
originalError: BYTE ¬ 0,
majorOpCode: BYTE ¬ 0,
minorOpCode: CARD16 ¬ 0,
badValue: CARD32 ¬ 0,
replyText, internal: REF ¬ NIL],
keyPress, keyRelease => [
keyCode: KeyCode,
seq: SequenceNo,
timeStamp: TimeStamp,
root: Window,
eventWindow: Window,
child: Window, -- ¬ nullWindow,
rootP: Point,
pos: Point,
state: SetOfKeyButMask, --immediately before event
sameScreen: BOOL],
buttonPress, buttonRelease => [
button: BYTE,
seq: SequenceNo,
timeStamp: TimeStamp,
root: Window,
eventWindow: Window,
child: Window, -- ¬ nullWindow,
rootP: Point,
pos: Point,
state: SetOfKeyButMask, --immediately before event
sameScreen: BOOL],
motionNotify => [
detail: NormalHint,
seq: SequenceNo,
timeStamp: TimeStamp,
root: Window,
eventWindow: Window,
child: Window,
rootP: Point,
pos: Point,
state: SetOfKeyButMask,
sameScreen: BOOL],
enterNotify, leaveNotify => [
detail: EnterLeaveDetail,
seq: SequenceNo,
timeStamp: TimeStamp,
root: Window,
eventWindow: Window,
child: Window,
rootP: Point,
eventP: Point,
state: SetOfKeyButMask,
mode: GrabMode[normal..ungrab],
sameScreen: BOOL,
focus: BOOL],
focusIn, focusOut => [
detail: FocusDetail,
seq: SequenceNo,
eventWindow: Window,
mode: GrabMode],
keymapNotify => [ --immediately follws enterNotify and focusIn events
--byte for keycodes 0-7 is omitted
keys: PACKED ARRAY [1..31] OF BYTE,
previousEvent: Event ¬ NIL --using this "backward" link instead a more "natural" forward link eliminates the need for waiting.
],
expose => [
seq: SequenceNo,
window: Window,
pos: Point,
size: Size,
count: CARD16],
graphicsExposure => [
seq: SequenceNo,
drawable: Drawable,
pos: Point,
size: Size,
minorOpcode: CARD16,
count: CARD16,
majorOpcode: BYTE],
noExposure => [
seq: SequenceNo,
drawable: Drawable,
minorOpcode: CARD16,
majorOpcode: BYTE],
visibilityNotify => [
seq: SequenceNo,
window: Window,
state: Visibility],
createNotify => [
seq: SequenceNo,
parent: Window,
window: Window,
geometry: Geometry ¬ nullGeometry,
overrideRedirect: BOOL],
destroyNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window],
unmapNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window,
fromConfigure: BOOL],
mapNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window,
overrideRedirect: BOOL],
mapRequest => [
seq: SequenceNo,
parent: Window,
window: Window],
reparentNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window,
parent: Window,
pos: Point,
overrideRedirect: BOOL],
configureNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window,
aboveSibling: Window,
geometry: Geometry ¬ nullGeometry,
overrideRedirect: BYTE],
configureRequest => [
stackMode: StackMode,
seq: SequenceNo,
parent: Window,
window: Window,
sibling: Window, -- ¬ nullWindow
geometry: Geometry ¬ nullGeometry,
valueMask: CARD16], --bitmask or packed array of bool?
gravityNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window,
pos: Point],
resizeRequest => [
seq: SequenceNo,
window: Window,
size: Size],
circulateNotify => [
seq: SequenceNo,
eventWindow: Window,
window: Window,
place: Place],
circulateRequest => [
seq: SequenceNo,
parent: Window,
window: Window,
place: Place],
propertyNotify => [
seq: SequenceNo,
window: Window,
atom: XAtom,
timeStamp: TimeStamp,
state: PropertyNotifyState],
selectionClear => [
seq: SequenceNo,
timeStamp: TimeStamp,
owner: Window,
selection: XAtom],
selectionRequest => [
seq: SequenceNo,
timeStamp: TimeStamp, --0 for currenttime
owner: Window,
requestor: Window,
selection: XAtom,
target: XAtom,
property: XAtom], -- 0 for none
selectionNotify => [
seq: SequenceNo,
timeStamp: TimeStamp, --0 for currenttime
requestor: Window,
selection: XAtom,
target: XAtom,
property: XAtom], -- 0 for none
colorMapNotify => [
seq: SequenceNo,
window: Window,
colorMap: ColorMap, --nullColorMap for none
new: BOOL,
installed: BOOL],
clientMessage => [ --the X client message event; goes through server
format: BYTE,
seq: SequenceNo,
window: Window,
typeAtom: XAtom,
data: SELECT OVERLAID * FROM --byte order problems => only one variant correct
b => [b: PACKED ARRAY [0..20) OF BYTE],
h => [h: PACKED ARRAY [0..10) OF CARD16],
w => [w: PACKED ARRAY [0..5) OF CARD32],
ENDCASE],
mappingNotify => [
seq: SequenceNo,
request: MappingNotifyKind,
firstKeycode: BYTE,
count: BYTE],
extension => [--extension of X protocol
extension: ATOM ¬ NIL, --denotes name of extension [if known]
match: PRIVATE REF ¬ NIL, --event matching help
decoded: REF READONLY ANY ¬ NIL, --event data in readable format [if known]
bytes: PACKED ARRAY [0..32) OF BYTE], --raw bits
finalEvent => [--locally generated when connection dies, closes, or, refcounts go to zero
refCountTransition: BOOL ¬ FALSE,
reason: REF ¬ NIL],
tipEvent => [--local, not passed through an X server
who: REF ¬ NIL, --reserved for "widget"
results: LIST OF REF ANY ¬ NIL, --please readonly
eventSource: Event, --If available
timeStamp: TimeStamp ¬ currentTime, --some relevant timestamp from server; not necessarily of last action
reserved: REF ¬ NIL],
replyEvent => [--reserved, don't try to set up a match for replies
seq: SequenceNo,
reply: REF ¬ NIL,
reserved: REF ¬ NIL],
ENDCASE
];
EventRope: PROC [event: Event] RETURNS [r: ROPE];
Debugging aid
SetOfEvent: TYPE ~ XlSetOfEvent.SetOfEvent;
This set of event type is used to describe what events an X server generates.
Distinguish generating an events from matching and consuming it!
SetOfPointerEvent: TYPE ~ SetOfEvent;
unspecifiedEvents: SetOfEvent ~ [];
--Small difference to X protocol
--When sent to the server:
-- Converted to not specifying any events.
--When received from server:
-- No events are enabled.
disableEvents: SetOfEvent ~ [reservedforDisableEvents: TRUE];
--Small difference to X protocol:
--When sent to the server:
-- Converted to no events before sending to the server
--Never returned by server.
ORSetOfEvents: PROC [s1, s2: SetOfEvent ¬ unspecifiedEvents] RETURNS [SetOfEvent] = INLINE {
RETURN [XlSetOfEvent.ORSetOfEvents[s1, s2]]
};
LegalEvents: PROC [e: SetOfEvent] RETURNS [SetOfEvent];
PointerEvents: PROC [e: SetOfEvent] RETURNS [SetOfPointerEvent];
DeviceEvents: PROC [e: SetOfEvent] RETURNS [SetOfEvent];
UnspecifiedEvents: PROC [e: SetOfEvent] RETURNS [BOOL]
~ INLINE {RETURN [e=unspecifiedEvents]};
Event access functions
ClientRequested: PROC [event: Event] RETURNS [BOOL] ~ INLINE {
Returns: event was generated by other X-client [not by X-server]
RETURN [event.originalCodeByte>127];
};
GetExtensionCard16: PROC [ev: ExtensionEvent, index: NAT] RETURNS [CARD16];
GetExtensionCard32: PROC [ev: ExtensionEvent, index: NAT] RETURNS [CARD32];
Sending events
SendEvent: PROC [c: Connection, destination: Window, propagate: BOOL, eventMask: SetOfEvent, eventBody: EventRep, details: Details ¬ NIL];
Ignores originalCodeByte, dispatchDrawable, connection, and, sequence number in eventBody
SendClientMessage32: PROC [c: Connection, destination: Window, propagate: BOOL ¬ FALSE, eventMask: SetOfEvent ¬ unspecifiedEvents, window: Window, type: XAtom, data: ARRAY[0..5) OF CARD32 ¬ ALL[0], details: Details ¬ NIL];
Short cut for frequent case of SendEvent
Abreviations
LocalEvent: TYPE ~ REF READONLY EventRep.local;
ExtensionEvent: TYPE ~ REF READONLY EventRep.extension;
KeyPressEvent: TYPE ~ REF READONLY EventRep.keyPress;
KeyReleaseEvent: TYPE ~ REF READONLY EventRep.keyRelease;
ButtonPressEvent: TYPE ~ REF READONLY EventRep.buttonPress;
ButtonReleaseEvent: TYPE ~ REF READONLY EventRep.buttonRelease;
MotionNotifyEvent: TYPE ~ REF READONLY EventRep.motionNotify;
EnterNotifyEvent: TYPE ~ REF READONLY EventRep.enterNotify;
LeaveNotifyEvent: TYPE ~ REF READONLY EventRep.leaveNotify;
FocusInEvent: TYPE ~ REF READONLY EventRep.focusIn;
FocusOutEvent: TYPE ~ REF READONLY EventRep.focusOut;
KeymapNotifyEvent: TYPE ~ REF READONLY EventRep.keymapNotify;
ExposeEvent: TYPE ~ REF READONLY EventRep.expose;
GraphicsExposureEvent: TYPE ~ REF READONLY EventRep.graphicsExposure;
NoExposureEvent: TYPE ~ REF READONLY EventRep.noExposure;
VisibilityNotifyEvent: TYPE ~ REF READONLY EventRep.visibilityNotify;
CreateNotifyEvent: TYPE ~ REF READONLY EventRep.createNotify;
DestroyNotifyEvent: TYPE ~ REF READONLY EventRep.destroyNotify;
UnmapNotifyEvent: TYPE ~ REF READONLY EventRep.unmapNotify;
MapNotifyEvent: TYPE ~ REF READONLY EventRep.mapNotify;
MapRequestEvent: TYPE ~ REF READONLY EventRep.mapRequest;
ReparentNotifyEvent: TYPE ~ REF READONLY EventRep.reparentNotify;
ConfigureNotifyEvent: TYPE ~ REF READONLY EventRep.configureNotify;
ConfigureRequestEvent: TYPE ~ REF READONLY EventRep.configureRequest;
GravityNotifyEvent: TYPE ~ REF READONLY EventRep.gravityNotify;
ResizeRequestEvent: TYPE ~ REF READONLY EventRep.resizeRequest;
CirculateNotifyEvent: TYPE ~ REF READONLY EventRep.circulateNotify;
CirculateRequestEvent: TYPE ~ REF READONLY EventRep.circulateRequest;
PropertyNotifyEvent: TYPE ~ REF READONLY EventRep.propertyNotify;
SelectionClearEvent: TYPE ~ REF READONLY EventRep.selectionClear;
SelectionRequestEvent: TYPE ~ REF READONLY EventRep.selectionRequest;
SelectionNotifyEvent: TYPE ~ REF READONLY EventRep.selectionNotify;
ColorMapNotifyEvent: TYPE ~ REF READONLY EventRep.colorMapNotify;
ClientMessageEvent: TYPE ~ REF READONLY EventRep.clientMessage;
MappingNotifyEvent: TYPE ~ REF READONLY EventRep.mappingNotify;
FinalEvent: TYPE ~ REF READONLY EventRep.finalEvent;
TipEvent: TYPE ~ REF READONLY EventRep.tipEvent;
ErrorNotifyEvent: TYPE ~ REF READONLY EventRep.errorNotify;
Private Types
ConnectionRep: PRIVATE TYPE ~ MONITORED RECORD [
--
--buffer for requests
bufNext: CARD ¬ 0, --internal next pointer
bufReady: CARD ¬ 0, --number of bytes ready to be flushed
bufLimit: CARD ¬ 0, --size of buffer
buf: LONG POINTER TO PACKED ARRAY [0..0) OF BYTE ¬ NIL,
bufPrivate: PRIVATE REF ¬ NIL, --real ref in case buf needs header information
bufExpected: PRIVATE CARD ¬ 0, --for self check on bufReady
bufSkipped: PRIVATE CARD ¬ 0, --for self check on bufReady
lastOpCode: PRIVATE CARD ¬ 0, --for debugging XlImpl only
bufDebug: PRIVATE CARD ¬ 0, --for debugging XlImpl only
sequenceNumber: SequenceNo ¬ 0,
bufProblem: REF ¬ NIL, --#NIL means an io error happened
alive: BOOL ¬ FALSE,
--
--various handles protocol relative
info: InfoRef ¬ NIL,
screenDepthS: REF READONLY ScreenDepthTuples ¬ NIL,
name: ROPE ¬ NIL,
displayNumber: INT ¬ 0,
defaultScreenNumber: INT ¬ 0,
lastTimeStamp: TimeStamp ¬ currentTime,
screenDepthTuplesCount: NAT ¬ 0,
synchCount: CARD ¬ 0, -- 0 asynchronous >0 synchronous error event reporting
--
--various handles for impls
cPriv: REF ConnectionPrivate ¬ NIL,
replyStuff: REF ReplyStuffRep ¬ NIL,
resourceStuff: REF ResourceStuffRep ¬ NIL,
dispatchStuff: REF DispatchStuffRep ¬ NIL,
service: REF ServiceRep ¬ NIL,
properties: PRIVATE PropList.List ¬ NIL,
serviceProperties: PRIVATE PropList.List ¬ NIL,
--
--network access
xmit: IO.STREAM ¬ NIL,
recv: IO.STREAM ¬ NIL,
sendSoon: PROC [out: IO.STREAM, when: CARD ¬ 0] ¬ NIL, --like NetworkStream.SendSoon.
errorFromStreamProc: PROC [self: IO.STREAM] RETURNS [ROPE] ¬ NIL,
needFlushing: BOOL ¬ FALSE,
isFlushing: BOOL ¬ FALSE,
--
--grab convention stuff
buttonGrabOwner: REF ¬ NIL,
buttonGrabTimeStamp: TimeStamp ¬ [0],
--
--more
errorMatch: Match ¬ NIL,
applicationKey: ATOM ¬ NIL,
lastError: REF READONLY ANY ¬ NIL, --for debugging
debugHelp: REF ¬ NIL --for debugging
];
ConnectionPrivate: PRIVATE TYPE;
ReplyStuffRep: PRIVATE TYPE;
ResourceStuffRep: PRIVATE TYPE;
DispatchStuffRep: PRIVATE TYPE;
ServiceRep: PRIVATE TYPE;
TQRep: PRIVATE TYPE;
GContextRep: PRIVATE TYPE;
FontRep: PRIVATE TYPE;
EventFilterRec: PRIVATE TYPE ~ RECORD [
activate: EventCodes ¬ ALL[FALSE],
activateExtensions: LIST OF REF ANY ¬ NIL
];
END.