summaryrefslogtreecommitdiffstats
path: root/client/gtk2/ibusimcontext.c
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-08-16 14:54:28 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-08-16 14:54:28 +0800
commit312499e2448ba96313ec90246c0cbe6d2b9a8c4c (patch)
treeadf8de806acce31e5e82f0d919d528c5e2cb2c47 /client/gtk2/ibusimcontext.c
parent81c8e05c3e4dd888d1db2f4c696fe11e6246cd64 (diff)
downloadibus-312499e2448ba96313ec90246c0cbe6d2b9a8c4c.tar.gz
ibus-312499e2448ba96313ec90246c0cbe6d2b9a8c4c.tar.xz
ibus-312499e2448ba96313ec90246c0cbe6d2b9a8c4c.zip
gtk im module can work now.
Diffstat (limited to 'client/gtk2/ibusimcontext.c')
-rw-r--r--client/gtk2/ibusimcontext.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index c65f4f3..c23e09b 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -223,7 +223,14 @@ ibus_im_context_init (IBusIMContext *obj)
"retrieve-surrounding", G_CALLBACK (_slave_retrieve_surrounding_cb), obj);
g_signal_connect (ibus->priv->slave,
"delete-surrounding", G_CALLBACK (_slave_delete_surrounding_cb), obj);
+
g_array_append_val (_im_context_array, obj);
+
+ if (ibus_im_client_get_connected (_client)) {
+ const gchar *ic = ibus_im_client_create_input_context (_client);
+ ibus_im_context_set_ic (ibus, ic);
+ g_hash_table_insert (_ic_table, ibus_im_context_get_ic (ibus), ibus);
+ }
}
static void
@@ -443,6 +450,16 @@ _client_commit_string_cb (IBusIMClient *client, const gchar *ic, const gchar *st
}
static void
+_client_forward_event_cb (IBusIMClient *client, const gchar *ic, GdkEvent *event, gpointer user_data)
+{
+ IBusIMContext *context = g_hash_table_lookup (_ic_table, ic);
+ g_return_if_fail (context != NULL);
+
+ event->any.send_event = TRUE;
+ gdk_event_put (event);
+}
+
+static void
_client_update_preedit_cb (IBusIMClient *client, const gchar *ic, const gchar *string,
PangoAttrList *attrs, gint cursor_pos, gboolean visible, gpointer user_data)
{
@@ -535,6 +552,8 @@ _init_ibus_client (void)
G_CALLBACK (_client_disconnected_cb), NULL);
g_signal_connect (_client, "commit-string",
G_CALLBACK (_client_commit_string_cb), NULL);
+ g_signal_connect (_client, "forward-event",
+ G_CALLBACK (_client_forward_event_cb), NULL);
g_signal_connect (_client, "update-preedit",
G_CALLBACK (_client_update_preedit_cb), NULL);
g_signal_connect (_client, "show-preedit",
@@ -629,8 +648,8 @@ void
ibus_im_context_set_ic (IBusIMContext *context, const gchar *ic)
{
IBusIMContextPrivate *priv = context->priv;
- g_free (priv->ic);
+ g_free (priv->ic);
priv->ic = g_strdup (ic);
if (priv->ic == NULL) {