## WebKitInputMethodContext WebKitInputMethodContext — Base class for input method contexts |

## Functions

void | webkit_input_method_context_set_enable_preedit ()
void | webkit_input_method_context_get_preedit ()
gboolean | webkit_input_method_context_filter_key_event ()
void | webkit_input_method_context_notify_focus_in ()
void | webkit_input_method_context_notify_focus_out ()
void | webkit_input_method_context_notify_cursor_area ()
void | webkit_input_method_context_notify_surrounding ()
void | webkit_input_method_context_reset ()
WebKitInputPurpose | webkit_input_method_context_get_input_purpose ()
void | webkit_input_method_context_set_input_purpose ()
WebKitInputHints | webkit_input_method_context_get_input_hints ()
void | webkit_input_method_context_set_input_hints ()
WebKitInputMethodUnderline * | webkit_input_method_underline_new ()
WebKitInputMethodUnderline * | webkit_input_method_underline_copy ()
void | webkit_input_method_underline_free ()
void | webkit_input_method_underline_set_color ()

## Properties

WebKitInputHints | input-hints | Read / Write
WebKitInputPurpose | input-purpose | Read / Write

## Signals

void | committed | Run Last
void | delete-surrounding | Run Last
void | preedit-changed | Run Last
void | preedit-finished | Run Last
void | preedit-started | Run Last

## Types and Values

struct | WebKitInputMethodContext
enum | WebKitInputPurpose
enum | WebKitInputHints
| WebKitInputMethodUnderline

## Object Hierarchy

        GBoxed
        ╰── WebKitInputMethodUnderline
        GEnum
        ╰── WebKitInputPurpose
        GObject
        ╰── WebKitInputMethodContext

## Description

WebKitInputMethodContext defines the interface to implement WebKit input methods. The input methods are used by WebKit, when editable content is focused, to map from key events to Unicode character strings.

An input method may consume multiple key events in sequence and finally output the composed result. This is called preediting, and an input method may provide feedback about this process by displaying the intermediate composition states as preedit text.

## Functions

### webkit_input_method_context_set_enable_preedit ()

    void
    webkit_input_method_context_set_enable_preedit
                                   (WebKitInputMethodContext *context,
                                    gboolean enabled);

Set whether `context` should enable preedit to display feedback.

#### Parameters

context | a WebKitInputMethodContext |
enabled | whether to enable preedit |

Since: 2.28

### webkit_input_method_context_get_preedit ()

    void
    webkit_input_method_context_get_preedit
                                   (WebKitInputMethodContext *context,
                                    char **text,
                                    GList **underlines,
                                    guint *cursor_offset);

Get the current preedit string for the `context` , and a list of WebKitInputMethodUnderline to apply to the string. The string will be displayed inserted at `cursor_offset` .

#### Parameters

context | a WebKitInputMethodContext |
text | location to store the preedit string. | [out][transfer full][nullable]
underlines | location to store the underlines as a GList of WebKitInputMethodUnderline. | [out][transfer full][nullable][element-type WebKit2.InputMethodUnderline]
cursor_offset | location to store the position of cursor in preedit string. | [out][nullable]

Since: 2.28

### webkit_input_method_context_filter_key_event ()

    gboolean
    webkit_input_method_context_filter_key_event
                                   (WebKitInputMethodContext *context,
                                    GdkEventKey *key_event);

Allow `key_event` to be handled by the input method. If `TRUE` is returned, then no further processing should be done for the key event.

#### Parameters

context | a WebKitInputMethodContext |
key_event | the key event to filter |

#### Returns

`TRUE` if the key event was handled, or `FALSE` otherwise

Since: 2.28

### webkit_input_method_context_notify_focus_in ()

    void
    webkit_input_method_context_notify_focus_in
                                   (WebKitInputMethodContext *context);

Notify `context` that input associated has gained focus.

#### Parameters

context | a WebKitInputMethodContext |

Since: 2.28

### webkit_input_method_context_notify_focus_out ()

    void
    webkit_input_method_context_notify_focus_out
                                   (WebKitInputMethodContext *context);

Notify `context` that input associated has lost focus.

#### Parameters

context | a WebKitInputMethodContext |

Since: 2.28

### webkit_input_method_context_notify_cursor_area ()

    void
    webkit_input_method_context_notify_cursor_area
                                   (WebKitInputMethodContext *context,
                                    int x,
                                    int y,
                                    int width,
                                    int height);

Notify `context` that cursor area changed in input associated.

#### Parameters

context | a WebKitInputMethodContext |
x | the x coordinate of cursor location |
y | the y coordinate of cursor location |
width | the width of cursor area |
height | the height of cursor area |

Since: 2.28

### webkit_input_method_context_notify_surrounding ()

    void
    webkit_input_method_context_notify_surrounding
                                   (WebKitInputMethodContext *context,
                                    const gchar *text,
                                    int length,
                                    guint cursor_index,
                                    guint selection_index);

Notify `context` that the context surrounding the cursor has changed. If there's no selection `selection_index` is the same as `cursor_index` .

#### Parameters

context | a WebKitInputMethodContext |
text | text surrounding the insertion point |
length | the length of `text` , or -1 if `text` is nul-terminated |
cursor_index | the byte index of the insertion cursor within `text` . |
selection_index | the byte index of the selection cursor within `text` . |

Since: 2.28

### webkit_input_method_context_reset ()

    void
    webkit_input_method_context_reset (WebKitInputMethodContext *context);

Reset the `context` . This will typically cause the input to clear the preedit state.

#### Parameters

context | a WebKitInputMethodContext |

Since: 2.28

### webkit_input_method_context_get_input_purpose ()

    WebKitInputPurpose
    webkit_input_method_context_get_input_purpose
                                   (WebKitInputMethodContext *context);

Get the value of the “input-purpose” property.

#### Parameters

context | a WebKitInputMethodContext |

#### Returns

the WebKitInputPurpose of the input associated with `context`

Since: 2.28

### webkit_input_method_context_set_input_purpose ()

    void
    webkit_input_method_context_set_input_purpose
                                   (WebKitInputMethodContext *context,
                                    WebKitInputPurpose purpose);

Set the value of the “input-purpose” property.

#### Parameters

context | a WebKitInputMethodContext |
purpose | a WebKitInputPurpose |

Since: 2.28

### webkit_input_method_context_get_input_hints ()

    WebKitInputHints
    webkit_input_method_context_get_input_hints
                                   (WebKitInputMethodContext *context);

Get the value of the “input-hints” property.

#### Parameters

context | a WebKitInputMethodContext |

#### Returns

the WebKitInputHints of the input associated with `context`

Since: 2.28

### webkit_input_method_context_set_input_hints ()

    void
    webkit_input_method_context_set_input_hints
                                   (WebKitInputMethodContext *context,
                                    WebKitInputHints hints);

### webkit_input_method_underline_new ()

    WebKitInputMethodUnderline *
    webkit_input_method_underline_new (guint start_offset,
                                       guint end_offset);

Create a new WebKitInputMethodUnderline for the given range in preedit string

#### Parameters

start_offset | the start offset in preedit string |
end_offset | the end offset in preedit string |

#### Returns

A newly created WebKitInputMethodUnderline.

[transfer full]

Since: 2.28

### webkit_input_method_underline_copy ()

    WebKitInputMethodUnderline *
    webkit_input_method_underline_copy (WebKitInputMethodUnderline *underline);

Make a copy of the WebKitInputMethodUnderline.

#### Parameters

underline | a WebKitInputMethodUnderline |

#### Returns

A copy of passed in WebKitInputMethodUnderline.

[transfer full]

Since: 2.28

### webkit_input_method_underline_free ()

    void
    webkit_input_method_underline_free (WebKitInputMethodUnderline *underline);

Free the WebKitInputMethodUnderline.

#### Parameters

underline | A WebKitInputMethodUnderline |

Since: 2.28

### webkit_input_method_underline_set_color ()

    void
    webkit_input_method_underline_set_color
                                   (WebKitInputMethodUnderline *underline,
                                    const GdkRGBA *rgba);

Set the color of the underline. If `rgba` is `NULL` the foreground text color will be used for the underline too.

#### Parameters

underline | a WebKitInputMethodUnderline |
rgba | a GdkRGBA or `NULL`. | [nullable]

Since: 2.28

## Types and Values

### struct WebKitInputMethodContext

    struct WebKitInputMethodContext;

### enum WebKitInputPurpose

Enum values used to describe the primary purpose of the active editable element.

#### Members

WEBKIT_INPUT_PURPOSE_FREE_FORM | Editable element expects any characters |
WEBKIT_INPUT_PURPOSE_DIGITS | Editable element expects digits |
WEBKIT_INPUT_PURPOSE_NUMBER | Editable element expects a number |
WEBKIT_INPUT_PURPOSE_PHONE | Editable element expects a telephone |
WEBKIT_INPUT_PURPOSE_URL | Editable element expects a URL |
WEBKIT_INPUT_PURPOSE_EMAIL | Editable element expects an email |
WEBKIT_INPUT_PURPOSE_PASSWORD | Editable element expects a password |

Since: 2.28

### enum WebKitInputHints

Enum values used to describe hints that might be taken into account by input methods.

#### Members

WEBKIT_INPUT_HINT_NONE | No special behavior suggested |
WEBKIT_INPUT_HINT_SPELLCHECK | Suggest spell checking |
WEBKIT_INPUT_HINT_LOWERCASE | Suggest to not autocapitlize |
WEBKIT_INPUT_HINT_UPPERCASE_CHARS | Suggest to capitalize all text |
WEBKIT_INPUT_HINT_UPPERCASE_WORDS | Suggest to capitalize the first character of each word |
WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES | Suggest to capitalize the first word of each sentence |
WEBKIT_INPUT_HINT_INHIBIT_OSK | Suggest to not show an onscreen keyboard |

Since: 2.28

### WebKitInputMethodUnderline

    typedef struct _WebKitInputMethodUnderline WebKitInputMethodUnderline;

## Property Details

### The `“input-hints”` property

      “input-hints”              WebKitInputHints

The hints of the input associated.

Owner: WebKitInputMethodContext

Flags: Read / Write

### The `“input-purpose”` property

      “input-purpose”            WebKitInputPurpose

The purpose of the input associated.

Owner: WebKitInputMethodContext

Flags: Read / Write

Default value: WEBKIT_INPUT_PURPOSE_FREE_FORM

## Signal Details

### The `“committed”` signal

    void
    user_function (WebKitInputMethodContext *context,
                   char                     *text,
                   gpointer                  user_data)

Emitted when a complete input sequence has been entered by the user. This can be a single character immediately after a key press or the final result of preediting.

#### Parameters

context | the WebKitInputMethodContext on which the signal is emitted |
text | the string result |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.28

### The `“delete-surrounding”` signal

    void
    user_function (WebKitInputMethodContext *context,
                   int                       offset,
                   guint                     n_chars,
                   gpointer                  user_data)

Emitted when the input method wants to delete the context surrounding the cursor. If `offset` is a negative value, it means a position before the cursor.

#### Parameters

context | the WebKitInputMethodContext on which the signal is emitted |
offset | the character offset from the cursor position of the text to be deleted. |
n_chars | the number of characters to be deleted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.28

### The `“preedit-changed”` signal

    void
    user_function (WebKitInputMethodContext *context,
                   gpointer                  user_data)

Emitted whenever the preedit sequence currently being entered has changed. It is also emitted at the end of a preedit sequence, in which case `webkit_input_method_context_get_preedit()` returns the empty string.

#### Parameters

context | the WebKitInputMethodContext on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.28

### The `“preedit-finished”` signal

    void
    user_function (WebKitInputMethodContext *context,
                   gpointer                  user_data)

Emitted when a preediting sequence has been completed or canceled.

#### Parameters

context | the WebKitInputMethodContext on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.28

### The `“preedit-started”` signal

    void
    user_function (WebKitInputMethodContext *context,
                   gpointer                  user_data)

Emitted when a new preediting sequence starts.

#### Parameters

context | the WebKitInputMethodContext on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.28

## See Also

WebKitWebView