Hooks into the Library

These functions allow you to define procedures that are to be called when various circumstances occur. The procedures include the creation of a new GC for a connection, the copying of a GC, the freeing of a GC, the creating and freeing of fonts, the conversion of events defined by extensions to and from wire format, and the handling of errors.

All of these functions return the previous procedure defined for this extension.

To define a procedure to be called whenever XCloseDisplay() is called, use XESetCloseDisplay().

To define a procedure to be called whenever a new GC is created, use XESetCreateGC().

To define a procedure to be called whenever a GC is copied, use XESetCopyGC().

To define a procedure to be called whenever a GC is freed, use XESetFreeGC().

To define a procedure to be called whenever XLoadQueryFont() and XQueryFont() are called, use XESetCreateFont().

To define a procedure to be called whenever a font is freed, use XESetFreeFont().

The XESetWireToEvent() and XESetEventToWire() functions allow you to define new events to the library. An XEvent structure always has a type code (type int) as the first component. This uniquely identifies what kind of event it is. The second component is always the serial number (type unsigned long) of the last request processed by the server. The third component is always a Boolean (type Bool) indicating whether the event came from a SendEvent protocol request. The fourth component is always a pointer to the display the event was read from. The fifth component is always a resource ID of one kind or another, usually a window, carefully selected to be useful to toolkit dispatchers. The fifth component should always exist, even if the event does not have a natural destination; if there is no value from the protocol to put in this component, initialize it to zero.

Note

There is an implementation limit such that your host event structure size cannot be bigger than the size of the XEvent union of structures. There also is no way to guarantee that more than 24 elements or 96 characters in the structure will be fully portable between machines.

To initialize the serial number component of the event, call _XSetLastRequestRead() with the event and use the return value.

To define a procedure to be called whenever an extension error needs to be converted from wire format to host format, use XESetWireToError().

To install an error procedure, use XESetError().

To define a procedure to be called to define an error message, use XESetErrorString().

To define a procedure to be called when an extension error is printed, to print the error value, use XESetPrintErrorValues().

To define a procedure to be called whenever a GC cache needs to be updated in the server, use XESetFlushGC().

To define a procedure to be called whenever data is about to be sent to the server, use XESetBeforeFlush().

Next: Hooks onto Xlib Data Structures
Christophe Tronche, ch@tronche.com