Do not use glib main loop in ibus_input_context_process_key function.
authorHuang Peng <shawn.p.huang@gmail.com>
Tue, 10 Feb 2009 02:17:01 +0000 (10:17 +0800)
committerHuang Peng <shawn.p.huang@gmail.com>
Tue, 10 Feb 2009 02:17:01 +0000 (10:17 +0800)
src/ibusconnection.c
src/ibusconnection.h
src/ibusinputcontext.c

index 90776cde35e477fde0552680f75fd1cfa0bbfa24..4821d6dbdce5e9aef3c0d9890ba254fcf23d67e6 100644 (file)
@@ -370,6 +370,16 @@ ibus_connection_get_connection (IBusConnection *connection)
     return priv->connection;
 }
 
+gboolean
+ibus_connection_read_write_dispatch (IBusConnection *connection,
+                                     gint            timeout)
+{
+    IBusConnectionPrivate *priv;
+    priv = IBUS_CONNECTION_GET_PRIVATE (connection);
+
+    return dbus_connection_read_write_dispatch (priv->connection, timeout);
+}
+
 typedef struct _VTableCallData {
     IBusMessageFunc message_func;
     gpointer user_data;
@@ -558,10 +568,14 @@ ibus_connection_send_with_reply (IBusConnection   *connection,
     IBusConnectionPrivate *priv;
     priv = IBUS_CONNECTION_GET_PRIVATE (connection);
 
-    return dbus_connection_send_with_reply (priv->connection,
-                                            message,
-                                            pending_return,
-                                            timeout_milliseconds);
+    gboolean retval;
+
+    retval = dbus_connection_send_with_reply (priv->connection,
+                                              message,
+                                              pending_return,
+                                              timeout_milliseconds);
+
+    return retval;
 }
 
 IBusMessage *
index e4a70f787f5adb547f142a0d8c166c4400e21201..5a8e0998877fc409aa9ea1389b8e6c6e8f450c2b 100644 (file)
@@ -94,6 +94,8 @@ IBusConnection  *ibus_connection_open_private       (const gchar        *address
 void             ibus_connection_close              (IBusConnection     *connection);
 gboolean         ibus_connection_is_connected       (IBusConnection     *connection);
 DBusConnection  *ibus_connection_get_connection     (IBusConnection     *connection);
+gboolean         ibus_connection_read_write_dispatch(IBusConnection     *connection,
+                                                     gint                timeout);
 gboolean         ibus_connection_send               (IBusConnection     *connection,
                                                      IBusMessage        *message);
 gboolean         ibus_connection_send_signal        (IBusConnection     *connection,
index 71de8fbd14b4a99eaf5022358f60f994f150f1bf..94de55a0e3d3d9bc3b61cdd05cddfc028e8e0b46 100644 (file)
@@ -573,7 +573,10 @@ ibus_input_context_process_key_event (IBusInputContext *context,
     }
 
     /* wait reply or timeout */
-    ibus_pending_call_wait (pending);
+    IBusConnection *connection = ibus_proxy_get_connection ((IBusProxy *) context);
+    while (!ibus_pending_call_get_completed (pending)) {
+        ibus_connection_read_write_dispatch (connection, -1);
+    }
 
     reply_message = ibus_pending_call_steal_reply (pending);
     ibus_pending_call_unref (pending);