XlExtensions.mesa
Copyright Ó 1993 by Xerox Corporation. All rights reserved.
Christian Jacobi, February 2, 1993 2:12:41 pm PST
Christian Jacobi, February 2, 1993 3:23 pm PST
Private interface to implement X window extensions for Xl
DIRECTORY Xl;
XlExtensions: CEDAR DEFINITIONS ~
BEGIN
Features used by Xl to implement extensions
ExtensionData: TYPE = Extensions;
Used in ConnectionPrivate. Eventually use a private type of our own in Xl.
firstExtension: BYTE = 64; --first event code reserved for extension events
Extensions: TYPE = ARRAY [firstExtension..127] OF Extension ¬ ALL[NIL]; --mapping from event-code to implementor of the corresponding extension. Used per connection.
ProcessExtensionEvent: PROC [xEvent: REF Xl.EventRep.extension] RETURNS [reuse: BOOL];
Called from main event reading loop, to handle extension events
Features used by implementations of particular extensions
ExtensionContinue: TYPE = {noop, dispatch, reuse};
ProcessExtensionEventProc: TYPE = PROC [self: Extension, xEvent: REF Xl.EventRep.extension] RETURNS [continue: ExtensionContinue ¬ noop];
Type for procedure to decode extension events.
self: describes extension.
xEvent: event un-decoded as arrived from main-event-loop; connection field already initialized.
continue: dispatch to request dispatching the decoded event; reuse to indicate that the event object may be re-used.
Extension: TYPE = REF ExtensionRec;
ExtensionRec: TYPE = RECORD [ --per-connection description of an X window extension
state: REF ¬ NIL, --per-connection private data for the extension implementor
majorOpcode, firstEvent, firstError: BYTE ¬ 0, --data from X server
class: REF READONLY ExtensionClass --describes extension class
];
ExtensionClass: TYPE = RECORD [ --static description of this extension for all connections
key: ATOM,
processEvents: ProcessExtensionEventProc,
majorEventsCnt: NAT ¬ 0
];
DefineExtensionClass: PROC [key: ATOM, processEvents: ProcessExtensionEventProc, majorEventsCnt: NAT ¬ 1];
Globally registers an event processing procedure for handling events of this extension. (For all connections).
StartExtension: PROC [c: Xl.Connection, key: ATOM] RETURNS [Extension ¬ NIL];
Enables extension handling for this connection. Issues request to X server to find out about extension if called the first time. Does not raise errors.
Returns extension data.
Returns NIL if extension is not supported by server, or, key is not defined.
END.