Hooking into Xlib

These functions allow you to hook into the library. They are not normally used by application programmers but are used by people who need to extend the core X protocol and the X library interface. The functions, which generate protocol requests for X, are typically called stubs.

In extensions, stubs first should check to see if they have initialized themselves on a connection. If they have not, they then should call XInitExtension() to attempt to initialize themselves on the connection.

If the extension needs to be informed of GC/font allocation or deallocation or if the extension defines new event types, the functions described here allow the extension to be called when these events occur.

The XExtCodes structure returns the information from XInitExtension() and is defined in X11/Xlib.h :


typedef struct _XExtCodes {	/* public to extension, cannot be changed */
	int extension;	/* extension number */
	int major_opcode;	/* major op-code assigned by server */
	int first_event;	/* first event number for the extension */
	int first_error;	/* first error number for the extension */
} XExtCodes;

To allocate an XExtCodes, use XAddExtension().

Next: Hooks into the Library

Christophe Tronche, ch@tronche.com