### Class

# WebKit InputMethodContext

since: 2.28

#### Description [src]

    abstract class WebKit.InputMethodContext : GObject.Object
    {
      WebKitInputMethodContextPrivate* priv
    }

Base class for input method contexts.

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.

Available since: 2.28

#### Hierarchy

#### Ancestors

- GObject

#### Instance methods

###### webkit_input_method_context_filter_key_event

Allow `key_event` to be handled by the input method.

since: 2.28

###### webkit_input_method_context_get_input_hints

Get the value of the `WebKitInputMethodContext:input-hints` property.

since: 2.28

###### webkit_input_method_context_get_input_purpose

Get the value of the `WebKitInputMethodContext:input-purpose` property.

since: 2.28

###### webkit_input_method_context_get_preedit

Get the pre-edit string and a list of WebKitInputMethodUnderline.

since: 2.28

###### webkit_input_method_context_notify_cursor_area

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

since: 2.28

###### webkit_input_method_context_notify_focus_in

Notify `context` that input associated has gained focus.

since: 2.28

###### webkit_input_method_context_notify_focus_out

Notify `context` that input associated has lost focus.

since: 2.28

###### webkit_input_method_context_notify_surrounding

Notify `context` that the context surrounding the cursor has changed.

since: 2.28

###### webkit_input_method_context_reset

Reset the `context`.

since: 2.28

###### webkit_input_method_context_set_enable_preedit

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

since: 2.28

###### webkit_input_method_context_set_input_hints

Set the value of the `WebKitInputMethodContext:input-hints` property.

since: 2.28

###### webkit_input_method_context_set_input_purpose

Set the value of the `WebKitInputMethodContext:input-purpose` property.

since: 2.28

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### WebKit.InputMethodContext:input-hints

The `WebKitInputHints` of the input associated with this context.

since: 2.28

###### WebKit.InputMethodContext:input-purpose

The `WebKitInputPurpose` of the input associated with this context.

since: 2.28

#### Signals

###### WebKit.InputMethodContext::committed

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.

since: 2.28

###### WebKit.InputMethodContext::delete-surrounding

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.

since: 2.28

###### WebKit.InputMethodContext::preedit-changed

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.

since: 2.28

###### WebKit.InputMethodContext::preedit-finished

Emitted when a preediting sequence has been completed or canceled.

since: 2.28

###### WebKit.InputMethodContext::preedit-started

Emitted when a new preediting sequence starts.

since: 2.28

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct WebKitInputMethodContextClass {
      GObjectClass parent_class;
      void (* preedit_started) (
        WebKitInputMethodContext* context
      );
      void (* preedit_changed) (
        WebKitInputMethodContext* context
      );
      void (* preedit_finished) (
        WebKitInputMethodContext* context
      );
      void (* committed) (
        WebKitInputMethodContext* context,
        const char* text
      );
      void (* delete_surrounding) (
        WebKitInputMethodContext* context,
        int offset,
        guint n_chars
      );
      void (* set_enable_preedit) (
        WebKitInputMethodContext* context,
        gboolean enabled
      );
      void (* get_preedit) (
        WebKitInputMethodContext* context,
        gchar** text,
        GList** underlines,
        guint* cursor_offset
      );
      gboolean (* filter_key_event) (
        WebKitInputMethodContext* context,
        GdkEvent* key_event
      );
      void (* notify_focus_in) (
        WebKitInputMethodContext* context
      );
      void (* notify_focus_out) (
        WebKitInputMethodContext* context
      );
      void (* notify_cursor_area) (
        WebKitInputMethodContext* context,
        int x,
        int y,
        int width,
        int height
      );
      void (* notify_surrounding) (
        WebKitInputMethodContext* context,
        const gchar* text,
        guint length,
        guint cursor_index,
        guint selection_index
      );
      void (* reset) (
        WebKitInputMethodContext* context
      );
      void (* _webkit_reserved0) (
    void
      );
      void (* _webkit_reserved1) (
    void
      );
      void (* _webkit_reserved2) (
    void
      );
      void (* _webkit_reserved3) (
    void
      );
      void (* _webkit_reserved4) (
    void
      );
      void (* _webkit_reserved5) (
    void
      );
      void (* _webkit_reserved6) (
    void
      );
      void (* _webkit_reserved7) (
    void
      );
      void (* _webkit_reserved8) (
    void
      );
      void (* _webkit_reserved9) (
    void
      );
      void (* _webkit_reserved10) (
    void
      );
      void (* _webkit_reserved11) (
    void
      );
      void (* _webkit_reserved12) (
    void
      );
      void (* _webkit_reserved13) (
    void
      );
      void (* _webkit_reserved14) (
    void
      );
      void (* _webkit_reserved15) (
    void
      );

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`preedit_started: void (* preedit_started) ( WebKitInputMethodContext* context )`

  No description available.

`preedit_changed: void (* preedit_changed) ( WebKitInputMethodContext* context )`

  No description available.

`preedit_finished: void (* preedit_finished) ( WebKitInputMethodContext* context )`

  No description available.

`committed: void (* committed) ( WebKitInputMethodContext* context, const char* text )`

  No description available.

`delete_surrounding: void (* delete_surrounding) ( WebKitInputMethodContext* context, int offset, guint n_chars )`

  No description available.

`set_enable_preedit: void (* set_enable_preedit) ( WebKitInputMethodContext* context, gboolean enabled )`

  Called via `webkit_input_method_context_set_enable_preedit()` to control the use of the preedit string.

`get_preedit: void (* get_preedit) ( WebKitInputMethodContext* context, gchar** text, GList** underlines, guint* cursor_offset )`

  Called via `webkit_input_method_context_get_preedit()` to retrieve the text currently being preedited for display at the cursor position. Any input method which composes complex characters or any other compositions from multiple sequential key presses should override this method to provide feedback.

`filter_key_event: gboolean (* filter_key_event) ( WebKitInputMethodContext* context, GdkEvent* key_event )`

  Called via `webkit_input_method_context_filter_key_event()` on every key press or release event. Every non-trivial input method needs to override this in order to implement the mapping from key events to text. A return value of `TRUE` indicates to the caller that the event was consumed by the input method. In that case, the `WebKitInputMethodContext::committed` signal should be emitted upon completion of a key sequence to pass the resulting text back to the editable element. Alternatively, `FALSE` may be returned to indicate that the event wasn’t handled by the input method.

`notify_focus_in: void (* notify_focus_in) ( WebKitInputMethodContext* context )`

  Called via `webkit_input_method_context_notify_focus_in()` when an editable element of the `WebKitWebView` has gained focus.

`notify_focus_out: void (* notify_focus_out) ( WebKitInputMethodContext* context )`

  Called via `webkit_input_method_context_notify_focus_out()` when an editable element of the `WebKitWebView` has lost focus.

`notify_cursor_area: void (* notify_cursor_area) ( WebKitInputMethodContext* context, int x, int y, int width, int height )`

  Called via `webkit_input_method_context_notify_cursor_area()` to inform the input method of the current cursor location relative to the client window.

`notify_surrounding: void (* notify_surrounding) ( WebKitInputMethodContext* context, const gchar* text, guint length, guint cursor_index, guint selection_index )`

  Called via `webkit_input_method_context_notify_surrounding()` to update the context surrounding the cursor. The provided text should not include the preedit string.

`reset: void (* reset) ( WebKitInputMethodContext* context )`

  Called via `webkit_input_method_context_reset()` to signal a change that requires a reset. An input method that implements preediting should override this method to clear the preedit state on reset.

`_webkit_reserved0: void (* _webkit_reserved0) ( void )`

  No description available.

`_webkit_reserved1: void (* _webkit_reserved1) ( void )`

  No description available.

`_webkit_reserved2: void (* _webkit_reserved2) ( void )`

  No description available.

`_webkit_reserved3: void (* _webkit_reserved3) ( void )`

  No description available.

`_webkit_reserved4: void (* _webkit_reserved4) ( void )`

  No description available.

`_webkit_reserved5: void (* _webkit_reserved5) ( void )`

  No description available.

`_webkit_reserved6: void (* _webkit_reserved6) ( void )`

  No description available.

`_webkit_reserved7: void (* _webkit_reserved7) ( void )`

  No description available.

`_webkit_reserved8: void (* _webkit_reserved8) ( void )`

  No description available.

`_webkit_reserved9: void (* _webkit_reserved9) ( void )`

  No description available.

`_webkit_reserved10: void (* _webkit_reserved10) ( void )`

  No description available.

`_webkit_reserved11: void (* _webkit_reserved11) ( void )`

  No description available.

`_webkit_reserved12: void (* _webkit_reserved12) ( void )`

  No description available.

`_webkit_reserved13: void (* _webkit_reserved13) ( void )`

  No description available.

`_webkit_reserved14: void (* _webkit_reserved14) ( void )`

  No description available.

`_webkit_reserved15: void (* _webkit_reserved15) ( void )`

  No description available.

#### Virtual methods

###### WebKit.InputMethodContextClass.committed

No description available.

###### WebKit.InputMethodContextClass.delete_surrounding

No description available.

###### WebKit.InputMethodContextClass.filter_key_event

Allow `key_event` to be handled by the input method.

since: 2.28

###### WebKit.InputMethodContextClass.get_preedit

Get the pre-edit string and a list of WebKitInputMethodUnderline.

since: 2.28

###### WebKit.InputMethodContextClass.notify_cursor_area

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

since: 2.28

###### WebKit.InputMethodContextClass.notify_focus_in

Notify `context` that input associated has gained focus.

since: 2.28

###### WebKit.InputMethodContextClass.notify_focus_out

Notify `context` that input associated has lost focus.

since: 2.28

###### WebKit.InputMethodContextClass.notify_surrounding

Notify `context` that the context surrounding the cursor has changed.

since: 2.28

###### WebKit.InputMethodContextClass.preedit_changed

No description available.

###### WebKit.InputMethodContextClass.preedit_finished

No description available.

###### WebKit.InputMethodContextClass.preedit_started

No description available.

###### WebKit.InputMethodContextClass.reset

Reset the `context`.

since: 2.28

###### WebKit.InputMethodContextClass.set_enable_preedit

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

since: 2.28