# MInputContext Struct Reference
[Input Method (basic)]

Structure of input context. More...

## Data Fields

MInputMethod * | im
MText * | produced
void * | arg
int | active
struct {
int x
int y
int ascent
int descent
int fontsize
MText * mt
int pos
} | spot
void * | info
MText * | status
int | status_changed
MText * | preedit
int | preedit_changed
int | cursor_pos
int | cursor_pos_changed
MPlist * | candidate_list
int | candidate_index
int | candidate_show
int | candidates_changed
MPlist * | plist
int | candidate_from
int | candidate_to

## Detailed Description

Structure of input context.

The type `MInputContext` is the structure of input context objects.

## Field Documentation

MInputMethod* MInputContext::im

Backward pointer to the input method. It is set up be the function minput_create_ic().

MText* MInputContext::produced

M-text produced by the input method. It is set up by the function minput_lookup() .

void* MInputContext::arg

Argument given to the function minput_create_im().

int MInputContext::active

Flag telling whether the input context is currently active or inactive. The value is set to 1 (active) when the input context is created. It is toggled by the function minput_toggle().

int MInputContext::x

X and Y coordinate of the spot.

int MInputContext::y

int MInputContext::ascent

Ascent and descent pixels of the line of the spot.

int MInputContext::descent

int MInputContext::fontsize

Font size for preedit text in 1/10 point.

MText* MInputContext::mt

M-text at the spot, or NULL.

int MInputContext::pos

Character position in <mt> at the spot.

struct { ... } MInputContext::spot

Spot location and size of the input context.

void* MInputContext::info

The usage of the following members depends on the input method driver. The descriptions below are for the driver of an internal input method. They are set by the function <im>->driver.filter(). Pointer to extra information that <im>->driver.create_ic() setups. It is used to record the internal state of the input context.

MText* MInputContext::status

M-text describing the current status of the input context.

int MInputContext::status_changed

The function <im>->driver.filter() sets the value to 1 when it changes <status>.

MText* MInputContext::preedit

M-text containing the current preedit text. The function <im>->driver.filter() sets the value.

int MInputContext::preedit_changed

The function <im>->driver.filter() sets the value to 1 when it changes <preedit>.

int MInputContext::cursor_pos

Cursor position of <preedit>.

int MInputContext::cursor_pos_changed

The function <im>->driver.filter() sets the value to 1 when it changes <cursor_pos>.

MPlist* MInputContext::candidate_list

Plist of the current candidate groups. Each element is an M-text or a plist. If an element is an M-text (i.e. the key is Mtext), candidates in that group are characters in the M-text. If it is a plist (i.e. the key is Mplist), each element is an M-text, and candidates in that group are those M-texts.

int MInputContext::candidate_index

Index number of the currently selected candidate in all the candidates. The index of the first candidate is 0. If the number is 8, and the first candidate group contains 7 candidates, the currently selected candidate is the second element of the second candidate group.

int MInputContext::candidate_from

Start and the end positions of the preedit text where <candidate_list> corresponds to.

int MInputContext::candidate_to

int MInputContext::candidate_show

Flag telling whether the current candidate group must be shown or not. The function <im>->driver.filter() sets the value to 1 when an input method required to show candidates, and sets the value to 0 otherwise.

int MInputContext::candidates_changed

The function <im>->driver.filter() sets the value to bitwise OR of `enum` `MInputCandidatesChanged` when it changed any of the above members (<candidate_XXX>), and sets the value to 0 otherwise.

MPlist* MInputContext::plist

Plist that can be freely used by <im>->driver functions. The driver of internal input method uses it to exchange extra arguments and result for callback functions. The function <im>->driver.create_ic() sets this to an empty plist, and the function <im>->driver.destroy_ic() frees it by using m17n_object_unref().