GdkEventKey *event = (GdkEventKey *) user_data;
gboolean processed = FALSE;
- if (!ibus_input_context_process_key_event_finish (context,
- res,
- &processed,
- NULL)) {
+ if (!ibus_input_context_process_key_event_async_finish (context,
+ res, &processed, NULL)) {
processed = FALSE;
}
ibusimcontext->time = event->time;
}
- switch (event->type) {
- case GDK_KEY_RELEASE:
- if (_use_sync_mode) {
- retval = ibus_input_context_process_key_event_sync (ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state | IBUS_RELEASE_MASK);
- }
- else {
- ibus_input_context_process_key_event (ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state | IBUS_RELEASE_MASK,
- -1,
- NULL,
- _process_key_event_done,
- gdk_event_copy ((GdkEvent *) event));
- retval = TRUE;
+ guint state = event->state;
+ if (event->type == GDK_KEY_RELEASE) {
+ state |= IBUS_RELEASE_MASK;
+ }
+
+ if (_use_sync_mode) {
+ retval = ibus_input_context_process_key_event (
+ ibuscontext,
+ event->keyval,
+ event->hardware_keycode - 8,
+ state);
+ }
+ else {
+ ibus_input_context_process_key_event_async (
+ ibuscontext,
+ event->keyval,
+ event->hardware_keycode - 8,
+ state,
+ -1,
+ NULL,
+ _process_key_event_done,
+ gdk_event_copy ((GdkEvent *) event));
+ retval = TRUE;
- }
- break;
- case GDK_KEY_PRESS:
- if (_use_sync_mode) {
- retval = ibus_input_context_process_key_event_sync (ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state);
- }
- else {
- ibus_input_context_process_key_event (ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state,
- -1,
- NULL,
- _process_key_event_done,
- gdk_event_copy ((GdkEvent *) event));
- retval = TRUE;
- }
- break;
- default:
- retval = FALSE;
- break;
}
if (retval) {
ibusimcontext->time = event->time;
}
- switch (event->type) {
- case GDK_KEY_RELEASE:
- if (_use_sync_mode) {
- retval = ibus_input_context_process_key_event_sync (ibusimcontext->ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state | IBUS_RELEASE_MASK);
- }
- else {
- ibus_input_context_process_key_event (ibusimcontext->ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state | IBUS_RELEASE_MASK,
- -1,
- NULL,
- _process_key_event_done,
- gdk_event_copy ((GdkEvent *) event));
- retval = TRUE;
- }
- break;
- case GDK_KEY_PRESS:
- if (_use_sync_mode) {
- retval = ibus_input_context_process_key_event_sync (ibusimcontext->ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state);
- }
- else {
- ibus_input_context_process_key_event (ibusimcontext->ibuscontext,
- event->keyval,
- event->hardware_keycode - 8,
- event->state,
- -1,
- NULL,
- _process_key_event_done,
- gdk_event_copy ((GdkEvent *) event));
- retval = TRUE;
- }
- break;
- default:
- retval = FALSE;
+ guint state = event->state;
+ if (event->type == GDK_KEY_RELEASE) {
+ state |= IBUS_RELEASE_MASK;
+ }
+
+ if (_use_sync_mode) {
+ retval = ibus_input_context_process_key_event (
+ ibusimcontext->ibuscontext,
+ event->keyval,
+ event->hardware_keycode - 8,
+ state);
+ }
+ else {
+ ibus_input_context_process_key_event_async (
+ ibusimcontext->ibuscontext,
+ event->keyval,
+ event->hardware_keycode - 8,
+ state,
+ -1,
+ NULL,
+ _process_key_event_done,
+ gdk_event_copy ((GdkEvent *) event));
+ retval = TRUE;
}
if (retval) {
if (event.type == GDK_KEY_RELEASE) {
event.state |= IBUS_RELEASE_MASK;
}
- retval = ibus_input_context_process_key_event_sync (x11ic->context,
- event.keyval,
- event.hardware_keycode - 8,
- event.state);
+ retval = ibus_input_context_process_key_event (x11ic->context,
+ event.keyval,
+ event.hardware_keycode - 8,
+ event.state);
if (retval) {
if (! x11ic->has_preedit_area) {
_xim_set_cursor_location (x11ic);
ibus_input_context_page_down@Base 1.3.99.20101019
ibus_input_context_page_up@Base 1.3.99.20101019
ibus_input_context_process_key_event@Base 1.3.99.20101019
- ibus_input_context_process_key_event_finish@Base 1.3.99.20110124
- ibus_input_context_process_key_event_sync@Base 1.3.99.20110124
+ ibus_input_context_process_key_event_async_finish@Base 1.3.99.20110124
+ ibus_input_context_process_key_event_async@Base 1.3.99.20110124
ibus_input_context_property_activate@Base 1.3.99.20101019
ibus_input_context_property_hide@Base 1.3.99.20101019
ibus_input_context_property_show@Base 1.3.99.20101019
}
void
-ibus_input_context_process_key_event (IBusInputContext *context,
- guint32 keyval,
- guint32 keycode,
- guint32 state,
- gint timeout_msec,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+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)
{
g_assert (IBUS_IS_INPUT_CONTEXT (context));
}
gboolean
-ibus_input_context_process_key_event_finish (IBusInputContext *context,
- GAsyncResult *res,
- gboolean *processed,
- GError **error)
+ibus_input_context_process_key_event_async_finish (IBusInputContext *context,
+ GAsyncResult *res,
+ gboolean *processed,
+ GError **error)
{
g_assert (IBUS_IS_INPUT_CONTEXT (context));
g_assert (G_IS_ASYNC_RESULT (res));
gboolean
-ibus_input_context_process_key_event_sync (IBusInputContext *context,
- guint32 keyval,
- guint32 keycode,
- guint32 state)
+ibus_input_context_process_key_event (IBusInputContext *context,
+ guint32 keyval,
+ guint32 keycode,
+ guint32 state)
{
g_assert (IBUS_IS_INPUT_CONTEXT (context));
GVariant *result = g_dbus_proxy_call_sync ((GDBusProxy *) context,
- "ProcessKeyEvent", /* method_name */
+ "ProcessKeyEvent", /* method_name */
g_variant_new ("(uuu)",
- keyval, keycode, state), /* parameters */
- G_DBUS_CALL_FLAGS_NONE, /* flags */
- -1, /* timeout */
- NULL, /* cancellable */
+ keyval, keycode, state), /* parameters */
+ G_DBUS_CALL_FLAGS_NONE, /* flags */
+ -1, /* timeout */
+ NULL, /* cancellable */
NULL);
if (result != NULL) {
GDBusConnection *connection);
/**
- * ibus_input_context_process_key_event:
+ * ibus_input_context_process_key_event_async:
* @context: An IBusInputContext.
* @keyval: Key symbol of a key event.
* @keycode: Keycode of a key event.
*
* see_also: #IBusEngine::process-key-event
*/
-void ibus_input_context_process_key_event
+void ibus_input_context_process_key_event_async
(IBusInputContext *context,
guint32 keyval,
guint32 keycode,
gpointer user_data);
/**
- * ibus_input_context_process_key_event_finish:
+ * ibus_input_context_process_key_event_async_finish:
* @context: An IBusInputContext.
* @res: A GAsyncResult obtained from the GAsyncReadyCallback passed to
- * ibus_input_context_process_key_event().
+ * 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.
*
- * Finishes an operation started with ibus_input_context_process_key_event().
+ * Finishes an operation started with ibus_input_context_process_key_event_async().
*/
-gboolean ibus_input_context_process_key_event_finish
+gboolean ibus_input_context_process_key_event_async_finish
(IBusInputContext *context,
GAsyncResult *res,
gboolean *processed,
GError **error);
/**
- * ibus_input_context_process_key_event_sync:
+ * ibus_input_context_process_key_event:
* @context: An IBusInputContext.
* @keyval: Key symbol of a key event.
* @keycode: Keycode of a key event.
*
* Pass the key event to input method engine and wait for the reply from ibus.
*
- * @see_also: ibus_input_context_process_key_event()
+ * @see_also: ibus_input_context_process_key_event_async()
*/
-gboolean ibus_input_context_process_key_event_sync
+gboolean ibus_input_context_process_key_event
(IBusInputContext *context,
guint32 keyval,
guint32 keycode,