An internal input method has non Mnil
LANGUAGE, and the body is defined in the m17n database by the tag <Minput_method, LANGUAGE, NAME>. For this kind of input methods, the m17n library uses two predefined input method drivers, one for CUI use and the other for GUI use. Those driver utilize the input processing engine provided by the m17n library itself. The m17n database may provides an input method that is not only for a specific language. The database uses Mt
as LANGUAGE of such an input method.
An internal input method accepts an input key which is a symbol associated with an input event. As there is no way for the m17n
library
to know how input events are represented in an application program, an application programmer have to convert an input event to an input key by himself. See the documentation of the function minput_event_to_key() for the detail.
A foreign input method has Mnil
LANGUAGE, and the body is defined in an external resources (e.g. XIM of X Window System). For this kind of input methods, the symbol NAME must have a property of key Minput_driver
, and the value must be a pointer to an input method driver. Therefore, by preparing a proper driver, any kind of input method can be treated in the framework of the m17n
library
.
For convenience, the m17n-X library provides an input method driver that enables the input style of OverTheSpot for XIM, and stores Minput_driver
property of the symbol Mxim
with a pointer to the driver. See the documentation of m17n GUI API for the detail.
PROCESSING FLOW
The typical processing flow of handling an input method is:
|
|
|
|
|
This is the type of callback functions called from input method drivers. #IC is a pointer to an input context, #COMMAND is a name of callback for which the function is called. |
|
The type |
|
The minput_open_im() function opens an input method that matches language language and name name, and returns a pointer to the input method object newly allocated. This function at first decides an driver for the input method as below. If language is not Mnil, the driver pointed by the variable minput_driver is used.
If language is Mnil and name has Minput_driver property, the driver pointed to by the property value is used to open the input method. If name has no such property, Then, the member MInputDriver::open_im() of the driver is called.
arg is set in the member |
|
The minput_close_im() function closes the input method im, which must have been created by minput_open_im(). |
|
The minput_create_ic() function creates an input context object associated with input method im, and calls callback functions corresponding to Minput_preedit_start, Minput_status_start, and Minput_status_draw in this order.
NULL . |
|
The minput_destroy_ic() function destroys the input context ic, which must have been created by minput_create_ic(). It calls callback functions corresponding to Minput_preedit_done, Minput_status_done, and Minput_candidates_done in this order. |
|
The minput_filter() function filters input key key according to input context ic, and calls callback functions corresponding to Minput_preedit_draw, Minput_status_draw, and Minput_candidates_draw if the preedit text, the status, and the current candidate are changed respectively.
|
|
The minput_lookup() function looks up a text in the input context ic. key must be the same one provided to the previous call of minput_filter(). If a text was produced by the input method, it is concatenated to M-text mt. This function calls MInputDriver::lookup .
|
|
The minput_set_spot() function set the spot of input context ic to coordinate (x, y ) with the height ascent and descent . The semantics of these values depend on the input method driver. fontsize specfies the fontsize of a preedit text in 1/10 point. For instance, an driver designed to work in CUI environment may use x and y as column and row numbers, and ignore ascent and descent . An driver designed to work on a window system may treat x and y as pixel offsets relative to the origin of the client window, and treat ascent and descent as ascent and descent pixels of a line at (x . y ).
mt and pos is an M-text and a character position at the spot. mt may be |
|
The minput_toggle() function toggles the input method associated with the input context ic. |
|
The minput_reset_ic() function resets the input context ic by calling a callback functions corresponding to Minput_reset. It actually shifts the state to the initial one, and thus the current preediting text (if any) is committed. If necessary, a program can extract that text by calling minput_lookup() just after the call of minput_reset_ic(). In that case, the arguments |
|
The variable minput_default_driver is the default driver for internal input methods. The member MInputDriver::open_im() searches the m17n database for an input method that matches the tag < #Minput_method, language, name> and loads it.
The member MInputDriver::callback_list() is The macro M17N_INIT() sets the variable minput_driver to the pointer to this driver so that all internal input methods use it.
Therefore, unless |
|
|
|
The variable minput_driver is a pointer to the input method driver that is used by internal input methods. The macro M17N_INIT() initializes it to a pointer to minput_default_driver (if <m17n.h> is included) or to minput_gui_driver (if <m17n-gui.h> is included). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The variable minput_default_driver is the default driver for internal input methods. The member MInputDriver::open_im() searches the m17n database for an input method that matches the tag < #Minput_method, language, name> and loads it.
The member MInputDriver::callback_list() is The macro M17N_INIT() sets the variable minput_driver to the pointer to this driver so that all internal input methods use it.
Therefore, unless |
|
The variable minput_driver is a pointer to the input method driver that is used by internal input methods. The macro M17N_INIT() initializes it to a pointer to minput_default_driver (if <m17n.h> is included) or to minput_gui_driver (if <m17n-gui.h> is included). |
|
|