11.3 XIM Programming Interface

The input method programming interface departs in some ways from the style established by the rest of Xlib. Functions that set, modify, or query the attributes of an XIM or XIC have a variable-length argument list interface, similar to the interface of the X Toolkit XtVaSetValues function, for example. Attributes are specified by a null-terminated list of name/value pairs. Names are null-terminated character strings (of type char *), and values are of type XPointer, which is a new Xlib generic pointer type, like XtPointer, which replaces the non-standard caddr_t. There are predefined symbols for all of the XIM and XIC attribute names. These are named similarly to X Toolkit resource names: they are prefixed with XN (not XtN) and words in the name are separated by capitalization rather than underscores. They differ from the Xt convention in that the first letter after the XN prefix is capitalized. Example 11-1 shows this naming convention and the varargs interface used in C code. There is only a single defined XIM attribute, which is explained in 11.4.2 Querying Input Method Values. There are a number of XIC attributes, which are explained in 11.6 Input Context Attributes.

Example 11-1. The XIM varargs interface and attribute naming conventions

status = XSetICValues(ic, XNFocusWindow, w,
                          XNGeometryCallback, HandleIMGeometry,
                          NULL);

The XNPreeditAttributes and XNStatusAttributes attributes of an input context have a number of sub-attributes. In order to ...

Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.