Common Desktop Environment: Internationalization Programmer's Guide

Input Methods

The Common Desktop Environment provides the ability to enter localized input for an internationalized application that is using the Xm Toolkit. Specifically, the XmText[Field]() widgets are enabled to interface with input methods provided by each locale. In addition, the dtterm() client is enabled to use input methods.

By default, each internationalization client that uses the libXm Toolkit uses the input method associated with a locale specified by the user. The XmNinputMethod() resource is provided as a modifier on the locale name to allow a user to specify any alternative input method.

The user interface of the input method consists of several elements. The need for these areas is dependent on the input method being used. They are usually needed by input methods that require complex input processing and dialogs. See Figure 1-3 for an illustration of these areas.

Figure 1-3 Example of VendorShell widget with auxiliary (Japanese)

GraphicGraphic

Preedit Area

A preedit area is used to display the string being preedited. The input method supports four modes of preediting: OffTheSpot, OverTheSpot (default), Root, and None.


Note -

A string that has been committed cannot be reconverted. The status of the string is moved from the preedit area to the location where the user is entering characters.


OffTheSpot

In OffTheSpot mode preediting using an input method, the location of preediting is fixed at just below the MainWindow area and on the right side of the status area as shown in Figure 1-4. A Japanese input method is used for the example.

Figure 1-4 Example of OffTheSpot preediting with the VendorShell widget (Japanese)

Graphic

In the system environment, when preediting using an input method, the preedit string being preedited may be highlighted in some form depending on the input method.

To use OffTheSpot mode, set the XmNpreeditType() resource of the VendorShell() widget either with the XtSetValues() function or with a resource file. The XmNpreeditType() resource can also be set as the resource of a TopLevelShell(), ApplicationShell(), or DialogShell() widget, all of which are subclasses of the VendorShell() widget class.

OverTheSpot (Default)

In OverTheSpot mode, the location of the preedit area is set to where the user is trying to enter characters (for example, the insert cursor position of the Text widget that has the current focus). The characters in a preedit area are displayed at the cursor position as an overlay window, and they can be highlighted depending on the input method.

Although a preedit area may consist of multiple lines in OverTheSpot mode. The preedit area is always within the MainWindow area and cannot cross its edges in any direction.

Keep in mind that although the preEdit string under construction may be displayed as though it were part of the Text widget's text, it is not passed to the client and displayed in the underlying edit screen until preedit ends. See Figure 1-5 for an illustration.

To use OverTheSpot mode explicitly, set the XmNpreeditType() resource of the VendorShell() widget either with the XtSetValues() function or with a resource file. The XmNpreeditType() resource can be set as the resource of a TopLevelShell(), ApplicationShell(), or DialogShell() widget because these are subclasses of the VendorShell() widget class.

Figure 1-5 Example of OverTheSpot preediting with the VendorShell widget (Japanese)

Graphic

Root

In Root mode, the preedit and status areas are located separate from the client's window. The Root mode behavior is similar to OffTheSpot. See Figure 1-6 for an illustration.

Figure 1-6 Example of Root preediting with the VendorShell widget (Japanese)

Graphic

Status Area

A status area reports the input or keyboard status of the input method to the users. For OverTheSpot and OffTheSpot styles, the status area is located at the lower left corner of the VendorShell window.

The VendorShell() widget provides geometry management so that a status area is rearranged at the bottom corner of the VendorShell window if the VendorShell window is resized.

Auxiliary Area

An auxiliary area helps the user with preediting. Depending on the particular input method, an auxiliary area can be created. The Japanese input method in Figure 1-3 creates the following types of auxiliary areas:

MainWindow Area

A MainWindow area is the widget used as the working area of the input method. In the system environment, the sole child of the VendorShell() widget is the MainWindow widget. It can be any container widget, such as a RowColumn() widget. The user creates the container widget as the child of the VendorShell() widget.

Focus Area

A focus area is any descendant widget under the MainWindow() widget subtree that currently has focus. The Motif application programmer using existing widgets does not need to worry about the focus area. The important information to remember is that only one widget can have input method processing at a time. The input method processing moves to the window (widget) that currently has the focus.