diff --git a/ChangeLog b/ChangeLog index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index dd2da1e602..9d179f86ba 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Wed Dec 12 17:22:45 2001 Owen Taylor + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_set_slave): + Reset the existing slave before removing it to give + it a chance to commit and emit "preedit_changed" + in case there was still a preedit string. + 2001-12-12 Matthias Clasen * gtk/gtktextlayout.c: Typo fixes diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index ea51bab2d1..f95ef3e705 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -30,7 +30,8 @@ static void gtk_im_multicontext_init (GtkIMMulticontext static void gtk_im_multicontext_finalize (GObject *object); static void gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext, - GtkIMContext *slave); + GtkIMContext *slave, + gboolean finalizing); static void gtk_im_multicontext_set_client_window (GtkIMContext *context, GdkWindow *window); @@ -146,17 +147,21 @@ gtk_im_multicontext_new (void) static void gtk_im_multicontext_finalize (GObject *object) { - gtk_im_multicontext_set_slave (GTK_IM_MULTICONTEXT (object), NULL); + gtk_im_multicontext_set_slave (GTK_IM_MULTICONTEXT (object), NULL, TRUE); G_OBJECT_CLASS (parent_class)->finalize (object); } static void gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext, - GtkIMContext *slave) + GtkIMContext *slave, + gboolean finalizing) { if (multicontext->slave) { + if (!finalizing) + gtk_im_context_reset (multicontext->slave); + g_signal_handlers_disconnect_by_func (multicontext->slave, gtk_im_multicontext_preedit_start_cb, multicontext); @@ -169,8 +174,12 @@ gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext, g_signal_handlers_disconnect_by_func (multicontext->slave, gtk_im_multicontext_commit_cb, multicontext); - + g_object_unref (multicontext->slave); + multicontext->slave = NULL; + + if (!finalizing) + g_signal_emit_by_name (multicontext, "preedit_changed"); } multicontext->slave = slave; @@ -220,7 +229,7 @@ gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext) global_context_id = _gtk_im_module_get_default_context_id (locale); } - gtk_im_multicontext_set_slave (multicontext, _gtk_im_module_create (global_context_id)); + gtk_im_multicontext_set_slave (multicontext, _gtk_im_module_create (global_context_id), FALSE); multicontext->context_id = global_context_id; } @@ -285,7 +294,7 @@ gtk_im_multicontext_focus_in (GtkIMContext *context) */ if (!multicontext->context_id || strcmp (global_context_id, multicontext->context_id) != 0) - gtk_im_multicontext_set_slave (multicontext, NULL); + gtk_im_multicontext_set_slave (multicontext, NULL, FALSE); slave = gtk_im_multicontext_get_slave (multicontext); @@ -434,7 +443,7 @@ activate_cb (GtkWidget *menuitem, gtk_im_context_reset (GTK_IM_CONTEXT (context)); global_context_id = id; - gtk_im_multicontext_set_slave (context, NULL); + gtk_im_multicontext_set_slave (context, NULL, FALSE); } }