11.11 XIM Programming Checklist

The following list provides useful guidelines when writing an Xlib or Xt application or Xt widget that uses the R5 internationalized input mechanisms. It is followed by an example Xlib program that performs simple internationalized text input and implements most of the steps in the list.

  • Set the locale with setlocale. Use a locale name from a resource, or specify the empty string (""). In an Xt application do this from the special callback procedure registered with XtSetLanguageProc().

  • Verify that X supports the locale with XSupportsLocale().

  • Set the locale modifiers (i.e., the name of the input method to use) from a resource or with the empty string.

  • If you want your input method to be customizable with resources, create a database or get a handle to an already created one. In an Xt application, use XtDatabase().

  • Open a connection to the IM of the locale with XOpenIM(). Pass a resource database and the name and class the IM should use for looking up its resources in that database. Verify that the IM is successfully opened. If you are writing a widget, you can assume that a valid XIM will be passed as a resource, and skip this step.

  • Query the IM for its supported interaction styles. Choose one that your application can support based on the value of user-specified resources, or upon some criteria for which will provide the best user interface for your application. In a widget, this should be in the initialize method.

  • Create an XFontSet for use by the IC. ...

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.