12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFT13.5.7.3. String Conversion CallbackThe string conversion callback is triggered by the input method to request the client to return thestring to be converted. The returned string may be either a multibyte or wide character string,with an encoding matching the locale bound to the input context. The callback prototype is asfollows:void StringConversionCallback (ic, client_data, call_data)XIC ic;XPointer client_data;XIMStringConversionCallbackStruct *call_data;icclient_datacall_dataSpecifies the input method.Specifies the additional client data.Specifies the amount of the string to be converted.The callback is passed an XIMStringConversionCallbackStruct structure in the call_data argument.The text member is an XIMStringConversionText structure (see section 13.5.6.9) to befilled in by the client and describes the text to be sent to the input method. The data pointed to bythe string and feedback elements of the XIMStringConversionText structure will be freed usingXFree by the input method after the callback returns. So the client should not point to internalbuffers that are critical to the client. Similarly, because the feedback element is currently reservedfor future use, the client should set feedback to NULL to prevent the library from freeing memoryat some random location due to an uninitialized pointer.The XIMStringConversionCallbackStruct structure is defined as follows:typedef struct _XIMStringConversionCallbackStruct {XIMStringConversionPosition position;XIMCaretDirection direction;short factor;XIMStringConversionOperation operation;XIMStringConversionText *text;}XIMStringConversionCallbackStruct;typedef short XIMStringConversionPosition;typedef unsigned short XIMStringConversionOperation;#define XIMStringConversionSubstitution (0x0001)#define XIMStringConversionRetrieval (0x0002)XIMStringConversionPosition specifies the starting position of the string to be returned in theXIMStringConversionText structure. The value identifies a position, in units of characters, relativeto the client’s cursor position in the client’s buffer.The ending position of the text buffer is determined by the direction and factor members. Specifically,itisthe character position relative to the starting point as defined by the332

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!