Essentially, the context manager can be viewed as a two-dimensional, sparse array: one dimension is subscripted by the X resource ID and the other by a context type field. Each entry in the array contains a pointer to the data. Xlib provides context management functions with which you can save data values, get data values, delete entries, and create a unique context type. The symbols used are in X11/Xutil.h.
To save a data value that corresponds to a resource ID and context type, use XSaveContext().
To get the data associated with a resource ID and type, use XFindContext().
To delete an entry for a given resource ID and type, use XDeleteContext().
To create a unique context type that may be used in subsequent calls to XSaveContext() and XFindContext(), use XUniqueContext().