IBusInputContext

IBusInputContext — IBus input context proxy object.

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IBusInputContext;
                    IBusInputContextClass;
IBusInputContext *  ibus_input_context_new              (const gchar *path,
                                                         GDBusConnection *connection,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                ibus_input_context_new_async        (const gchar *path,
                                                         GDBusConnection *connection,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
IBusInputContext *  ibus_input_context_new_async_finish (GAsyncResult *res,
                                                         GError **error);
IBusInputContext *  ibus_input_context_get_input_context
                                                        (const gchar *path,
                                                         GDBusConnection *connection);
void                ibus_input_context_get_input_context_async
                                                        (const gchar *path,
                                                         GDBusConnection *connection,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
IBusInputContext *  ibus_input_context_get_input_context_async_finish
                                                        (GAsyncResult *res,
                                                         GError **error);
void                ibus_input_context_process_key_event_async
                                                        (IBusInputContext *context,
                                                         guint32 keyval,
                                                         guint32 keycode,
                                                         guint32 state,
                                                         gint timeout_msec,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            ibus_input_context_process_key_event_async_finish
                                                        (IBusInputContext *context,
                                                         GAsyncResult *res,
                                                         gboolean *processed,
                                                         GError **error);
gboolean            ibus_input_context_process_key_event
                                                        (IBusInputContext *context,
                                                         guint32 keyval,
                                                         guint32 keycode,
                                                         guint32 state);
void                ibus_input_context_set_cursor_location
                                                        (IBusInputContext *context,
                                                         gint32 x,
                                                         gint32 y,
                                                         gint32 w,
                                                         gint32 h);
void                ibus_input_context_set_capabilities (IBusInputContext *context,
                                                         guint32 capabilities);
void                ibus_input_context_property_activate
                                                        (IBusInputContext *context,
                                                         const gchar *prop_name,
                                                         guint32 state);
void                ibus_input_context_focus_in         (IBusInputContext *context);
void                ibus_input_context_focus_out        (IBusInputContext *context);
void                ibus_input_context_reset            (IBusInputContext *context);
void                ibus_input_context_enable           (IBusInputContext *context);
void                ibus_input_context_disable          (IBusInputContext *context);
void                ibus_input_context_is_enabled_async (IBusInputContext *context,
                                                         gint timeout_msec,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            ibus_input_context_is_enabled_async_finish
                                                        (IBusInputContext *context,
                                                         GAsyncResult *res,
                                                         gboolean *retval,
                                                         GError **error);
gboolean            ibus_input_context_is_enabled       (IBusInputContext *context);
void                ibus_input_context_get_engine_async (IBusInputContext *context,
                                                         gint timeout_msec,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
IBusEngineDesc *    ibus_input_context_get_engine_async_finish
                                                        (IBusInputContext *context,
                                                         GAsyncResult *res,
                                                         GError **error);
IBusEngineDesc *    ibus_input_context_get_engine       (IBusInputContext *context);
void                ibus_input_context_set_engine       (IBusInputContext *context,
                                                         const gchar *name);
void                ibus_input_context_set_surrounding_text
                                                        (IBusInputContext *context,
                                                         IBusText *text,
                                                         guint32 cursor_pos);
gboolean            ibus_input_context_needs_surrounding_text
                                                        (IBusInputContext *context);

Object Hierarchy

  GObject
   +----GDBusProxy
         +----IBusProxy
               +----IBusInputContext

Implemented Interfaces

IBusInputContext implements GInitable and GAsyncInitable.

Signals

  "commit-text"                                    : Run Last
  "cursor-down-lookup-table"                       : Run Last
  "cursor-up-lookup-table"                         : Run Last
  "delete-surrounding-text"                        : Run Last
  "disabled"                                       : Run Last
  "enabled"                                        : Run Last
  "forward-key-event"                              : Run Last
  "hide-auxiliary-text"                            : Run Last
  "hide-lookup-table"                              : Run Last
  "hide-preedit-text"                              : Run Last
  "page-down-lookup-table"                         : Run Last
  "page-up-lookup-table"                           : Run Last
  "register-properties"                            : Run Last
  "show-auxiliary-text"                            : Run Last
  "show-lookup-table"                              : Run Last
  "show-preedit-text"                              : Run Last
  "update-auxiliary-text"                          : Run Last
  "update-lookup-table"                            : Run Last
  "update-preedit-text"                            : Run Last
  "update-property"                                : Run Last

Description

An IBusInputContext is a proxy object of BusInputContext, which manages the context for input methods that supports text input in various natural languages.

Clients call the IBusInputContext to invoke BusInputContext, through which invokes IBusEngine.

Details

IBusInputContext

typedef struct _IBusInputContext IBusInputContext;

An opaque data type representing an IBusInputContext.


IBusInputContextClass

typedef struct {
    IBusProxyClass parent;
    /* signals */
} IBusInputContextClass;


ibus_input_context_new ()

IBusInputContext *  ibus_input_context_new              (const gchar *path,
                                                         GDBusConnection *connection,
                                                         GCancellable *cancellable,
                                                         GError **error);

returns: A newly allocated IBusInputContext.

New an IBusInputContext.

path :

The path to the object that emitting the signal.

connection :

An GDBusConnection.

cancellable :

A GCancellable or NULL.

error :

Return location for error or NULL.

Returns :


ibus_input_context_new_async ()

void                ibus_input_context_new_async        (const gchar *path,
                                                         GDBusConnection *connection,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

New an IBusInputContext asynchronously.

path :

The path to the object that emitting the signal.

connection :

An GDBusConnection.

cancellable :

A GCancellable or NULL.

callback :

A GAsyncReadyCallback to call when the request is satisfied. The callback should not be NULL.

user_data :

The data to pass to callback.

ibus_input_context_new_async_finish ()

IBusInputContext *  ibus_input_context_new_async_finish (GAsyncResult *res,
                                                         GError **error);

returns: A newly allocated IBusInputContext.

Finishes an operation started with ibus_input_context_new_async().

res :

A GAsyncResult obtained from the GAsyncReadyCallback pass to ibus_input_context_new_async().

error :

Return location for error or NULL.

Returns :


ibus_input_context_get_input_context ()

IBusInputContext *  ibus_input_context_get_input_context
                                                        (const gchar *path,
                                                         GDBusConnection *connection);

Gets an existing IBusInputContext.

path :

The path to the object that emitting the signal.

connection :

An GDBusConnection.

Returns :

An existing IBusInputContext. [transfer none]

ibus_input_context_get_input_context_async ()

void                ibus_input_context_get_input_context_async
                                                        (const gchar *path,
                                                         GDBusConnection *connection,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Get an existing IBusInputContext asynchronously.

path :

The path to the object that emitting the signal.

connection :

An GDBusConnection.

cancellable :

A GCancellable or NULL.

callback :

A GAsyncReadyCallback to call when the request is satisfied. The callback should not be NULL.

user_data :

The data to pass to callback.

ibus_input_context_get_input_context_async_finish ()

IBusInputContext *  ibus_input_context_get_input_context_async_finish
                                                        (GAsyncResult *res,
                                                         GError **error);

returns: (transfer none): An existing IBusInputContext.

Finishes an operation started with ibus_input_contex_get_input_context_async().

res :

A GAsyncResult obtained from the GAsyncReadyCallback pass to ibus_input_context_get_input_context_async().

error :

Return location for error or NULL.

Returns :


ibus_input_context_process_key_event_async ()

void                ibus_input_context_process_key_event_async
                                                        (IBusInputContext *context,
                                                         guint32 keyval,
                                                         guint32 keycode,
                                                         guint32 state,
                                                         gint timeout_msec,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Pass the key event to input method engine.

Key symbols are characters/symbols produced by key press, for example, pressing "s" generates key symbol "s"; pressing shift-"s" generates key symbol "S". Same key on keyboard may produce different key symbols on different keyboard layout. e.g., "s" key on QWERTY keyboard produces "o" in DVORAK layout.

Unlike key symbol, keycode is only determined by the location of the key, and irrelevant of the keyboard layout.

Briefly speaking, input methods that expect certain keyboard layout should use keycode; otherwise keyval is sufficient. For example, Chewing, Cangjie, Wubi expect an en-US QWERTY keyboard, these should use keycode; while pinyin can rely on keyval only, as it is less sensitive to the keyboard layout change, DVORAK users can still use DVORAK layout to input pinyin.

Use ibus_keymap_lookup_keysym() to convert keycode to keysym in given keyboard layout.

see_also: "process-key-event"

context :

An IBusInputContext.

keyval :

Key symbol of a key event.

keycode :

Keycode of a key event.

state :

Key modifier flags.

timeout_msec :

The timeout in milliseconds or -1 to use the default timeout.

cancellable :

A GCancellable or NULL.

callback :

A GAsyncReadyCallback to call when the request is satisfied or NULL if you don't care about the result of the method invocation.

user_data :

The data to pass to callback.

ibus_input_context_process_key_event_async_finish ()

gboolean            ibus_input_context_process_key_event_async_finish
                                                        (IBusInputContext *context,
                                                         GAsyncResult *res,
                                                         gboolean *processed,
                                                         GError **error);

Finishes an operation started with ibus_input_context_process_key_event_async().

context :

An IBusInputContext.

res :

A GAsyncResult obtained from the GAsyncReadyCallback passed to ibus_input_context_process_key_event_async().

processed :

A point to a bool value. If the the key event is processed, it will assigned to TRUE, FALSE otherwise.

error :

Return location for error or NULL.

Returns :

TRUE for success; FALSE otherwise.

ibus_input_context_process_key_event ()

gboolean            ibus_input_context_process_key_event
                                                        (IBusInputContext *context,
                                                         guint32 keyval,
                                                         guint32 keycode,
                                                         guint32 state);

Pass the key event to input method engine and wait for the reply from ibus (i.e. synchronous IPC).

see_also: ibus_input_context_process_key_event_async()

context :

An IBusInputContext.

keyval :

Key symbol of a key event.

keycode :

Keycode of a key event.

state :

Key modifier flags.

Returns :

TRUE for successfully process the key; FALSE otherwise.

ibus_input_context_set_cursor_location ()

void                ibus_input_context_set_cursor_location
                                                        (IBusInputContext *context,
                                                         gint32 x,
                                                         gint32 y,
                                                         gint32 w,
                                                         gint32 h);

Set the cursor location of IBus input context asynchronously.

see_also: "set-cursor-location"

context :

An IBusInputContext.

x :

X coordinate of the cursor.

y :

Y coordinate of the cursor.

w :

Width of the cursor.

h :

Height of the cursor.

ibus_input_context_set_capabilities ()

void                ibus_input_context_set_capabilities (IBusInputContext *context,
                                                         guint32 capabilities);

Set the capabilities flags of client application asynchronously. When IBUS_CAP_FOCUS is not set, IBUS_CAP_PREEDIT_TEXT, IBUS_CAP_AUXILIARY_TEXT, IBUS_CAP_LOOKUP_TABLE, and IBUS_CAP_PROPERTY have to be all set. The panel component does nothing for an application that doesn't support focus.

see_also: "set-capabilities"

context :

An IBusInputContext.

capabilities :

Capabilities flags of IBusEngine, see IBusCapabilite

ibus_input_context_property_activate ()

void                ibus_input_context_property_activate
                                                        (IBusInputContext *context,
                                                         const gchar *prop_name,
                                                         guint32 state);

Activate the property asynchronously.

see_also: "property_activate"

context :

An IBusInputContext.

prop_name :

A property name (e.g. "InputMode.WideLatin")

state :

A status of the property (e.g. PROP_STATE_CHECKED)

ibus_input_context_focus_in ()

void                ibus_input_context_focus_in         (IBusInputContext *context);

Invoked when the client application get focus. An asynchronous IPC will be performed.

see_also: "focus_in".

context :

An IBusInputContext.

ibus_input_context_focus_out ()

void                ibus_input_context_focus_out        (IBusInputContext *context);

Invoked when the client application get focus. An asynchronous IPC will be performed.

see_also: "focus_out".

context :

An IBusInputContext.

ibus_input_context_reset ()

void                ibus_input_context_reset            (IBusInputContext *context);

Invoked when the IME is reset. An asynchronous IPC will be performed.

see_also: "reset"

context :

An IBusInputContext.

ibus_input_context_enable ()

void                ibus_input_context_enable           (IBusInputContext *context);

Invoked when the IME is enabled, either by IME switch hotkey or select from the menu. An asynchronous IPC will be performed.

see_also: "enable"

context :

An IBusInputContext.

ibus_input_context_disable ()

void                ibus_input_context_disable          (IBusInputContext *context);

Invoked when the IME is disabled, either by IME switch hotkey or select from the menu. An asynchronous IPC will be performed.

see_also: "disable"

context :

An IBusInputContext.

ibus_input_context_is_enabled_async ()

void                ibus_input_context_is_enabled_async (IBusInputContext *context,
                                                         gint timeout_msec,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

An asynchronous IPC will be performed.

context :

An IBusInputContext.

timeout_msec :

The timeout in milliseconds or -1 to use the default timeout.

cancellable :

A GCancellable or NULL.

callback :

A GAsyncReadyCallback to call when the request is satisfied or NULL if you don't care about the result of the method invocation.

user_data :

The data to pass to callback.

ibus_input_context_is_enabled_async_finish ()

gboolean            ibus_input_context_is_enabled_async_finish
                                                        (IBusInputContext *context,
                                                         GAsyncResult *res,
                                                         gboolean *retval,
                                                         GError **error);

Finishes an operation started with ibus_input_context_is_enabled_async().

context :

An IBusInputContext.

res :

A GAsyncResult obtained from the GAsyncReadyCallback passed to ibus_input_context_is_enabled_async().

retval :

If the the context is enabled, it will be assigned to TRUE, FALSE otherwise.

error :

Return location for error or NULL.

Returns :

TRUE for success; FALSE otherwise.

ibus_input_context_is_enabled ()

gboolean            ibus_input_context_is_enabled       (IBusInputContext *context);

Returns TRUE if the IME is enabled on the context. A asynchronous IPC will be performed.

context :

An IBusInputContext.

Returns :

TRUE if the IME is enabled on the context.

ibus_input_context_get_engine_async ()

void                ibus_input_context_get_engine_async (IBusInputContext *context,
                                                         gint timeout_msec,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

An asynchronous IPC will be performed.

context :

An IBusInputContext.

timeout_msec :

The timeout in milliseconds or -1 to use the default timeout.

cancellable :

A GCancellable or NULL.

callback :

A GAsyncReadyCallback to call when the request is satisfied or NULL if you don't care about the result of the method invocation.

user_data :

The data to pass to callback.

ibus_input_context_get_engine_async_finish ()

IBusEngineDesc *    ibus_input_context_get_engine_async_finish
                                                        (IBusInputContext *context,
                                                         GAsyncResult *res,
                                                         GError **error);

Finishes an operation started with ibus_input_context_get_engine_async().

context :

An IBusInputContext.

res :

A GAsyncResult obtained from the GAsyncReadyCallback passed to ibus_input_context_get_engine_async().

error :

Return location for error or NULL.

Returns :

An IME engine description for the context, or NULL. [transfer none]

ibus_input_context_get_engine ()

IBusEngineDesc *    ibus_input_context_get_engine       (IBusInputContext *context);

Returns an IME engine description for the context. A synchronous IPC will be performed.

context :

An IBusInputContext.

Returns :

An IME engine description for the context, or NULL. [transfer none]

ibus_input_context_set_engine ()

void                ibus_input_context_set_engine       (IBusInputContext *context,
                                                         const gchar *name);

Invoked when the IME engine is changed. An asynchronous IPC will be performed.

context :

An IBusInputContext.

name :

A name of the engine.

ibus_input_context_set_surrounding_text ()

void                ibus_input_context_set_surrounding_text
                                                        (IBusInputContext *context,
                                                         IBusText *text,
                                                         guint32 cursor_pos);

context :

An IBusInputContext.

text :

An IBusText surrounding the current cursor on the application.

cursor_pos :


ibus_input_context_needs_surrounding_text ()

gboolean            ibus_input_context_needs_surrounding_text
                                                        (IBusInputContext *context);

Check whether the current engine requires surrounding-text.

context :

An IBusInputContext.

Returns :

TRUE if surrounding-text is needed by the current engine; FALSE otherwise.

Signal Details

The "commit-text" signal

void                user_function                      (IBusInputContext *context,
                                                        IBusText         *text,
                                                        gpointer          user_data)      : Run Last

Emitted when the text is going to be committed.

(Note: The text object is floating, and it will be released after the signal. If singal handler want to keep the object, the handler should use g_object_ref_sink() to get the ownership of the object.)

context :

An IBusInputContext.

text :

Text to be committed.

user_data :

user data set when the signal handler was connected.

The "cursor-down-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to select next candidate of lookup table.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "cursor-up-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to select previous candidate of lookup table.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "delete-surrounding-text" signal

void                user_function                      (IBusInputContext *context,
                                                        gint              offset,
                                                        guint             n_chars,
                                                        gpointer          user_data)      : Run Last

Emitted to delete surrounding text event from IME to client of IME.

context :

An IBusInputContext.

offset :

the character offset from the cursor position of the text to be deleted. A negative value indicates a position before the cursor.

n_chars :

the number of characters to be deleted.

user_data :

user data set when the signal handler was connected.

The "disabled" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted when an IME is disabled.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "enabled" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted when an IME is enabled.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "forward-key-event" signal

void                user_function                      (IBusInputContext *context,
                                                        guint             keyval,
                                                        guint             keycode,
                                                        guint             modifiers,
                                                        gpointer          user_data)      : Run Last

Emitted to forward key event from IME to client of IME.

context :

An IBusInputContext.

keyval :

Key symbol of the keyboard event.

keycode :

Key symbol of the keyboard event.

modifiers :

Key modifier flags.

user_data :

user data set when the signal handler was connected.

The "hide-auxiliary-text" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to hide auxiliary text.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "hide-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to hide lookup table.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "hide-preedit-text" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to hide preedit text.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "page-down-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to view the next page of lookup table.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "page-up-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to view the previous page of lookup table.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "register-properties" signal

void                user_function                      (IBusInputContext *context,
                                                        IBusPropList     *props,
                                                        gpointer          user_data)      : Run Last

Emitted to register the properties in props.

(Note: The props object is floating, and it will be released after the signal. If singal handler want to keep the object, the handler should use g_object_ref_sink() to get the ownership of the object.)

context :

An IBusInputContext.

props :

An IBusPropList that contains properties.

user_data :

user data set when the signal handler was connected.

The "show-auxiliary-text" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to show auxiliary text.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "show-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to show lookup table.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "show-preedit-text" signal

void                user_function                      (IBusInputContext *context,
                                                        gpointer          user_data)      : Run Last

Emitted to show preedit text.

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "update-auxiliary-text" signal

void                user_function                      (IBusInputContext *context,
                                                        IBusText         *arg1,
                                                        gboolean          arg2,
                                                        gpointer          user_data)      : Run Last

Emitted to hide auxilary text.

(Note: The text object is floating, and it will be released after the signal. If singal handler want to keep the object, the handler should use g_object_ref_sink() to get the ownership of the object.)

context :

An IBusInputContext.

user_data :

user data set when the signal handler was connected.

The "update-lookup-table" signal

void                user_function                      (IBusInputContext *context,
                                                        IBusLookupTable  *table,
                                                        gboolean          visible,
                                                        gpointer          user_data)      : Run Last

Emitted to update lookup table.

(Note: The table object is floating, and it will be released after the signal. If singal handler want to keep the object, the handler should use g_object_ref_sink() to get the ownership of the object.)

context :

An IBusInputContext.

table :

An IBusLookupTable to be updated.

visible :

Whether the table should be visible.

user_data :

user data set when the signal handler was connected.

The "update-preedit-text" signal

void                user_function                      (IBusInputContext *context,
                                                        IBusText         *text,
                                                        guint             cursor_pos,
                                                        gboolean          visible,
                                                        gpointer          user_data)       : Run Last

Emitted to update preedit text.

(Note: The text object is floating, and it will be released after the signal. If singal handler want to keep the object, the handler should use g_object_ref_sink() to get the ownership of the object.)

context :

An IBusInputContext.

text :

Text to be updated.

cursor_pos :

Cursor position.

visible :

Whether the update is visible.

user_data :

user data set when the signal handler was connected.

The "update-property" signal

void                user_function                      (IBusInputContext *context,
                                                        IBusProperty     *prop,
                                                        gpointer          user_data)      : Run Last

Emitted to update the property prop.

(Note: The prop object is floating, and it will be released after the signal. If singal handler want to keep the object, the handler should use g_object_ref_sink() to get the ownership of the object.)

context :

An IBusInputContext.

prop :

The IBusProperty to be updated.

user_data :

user data set when the signal handler was connected.