/* If im_context exists, reset any preedit display & disconnect its signals */ if (text->im_context && GTK_IS_IM_CONTEXT(text->im_context)) { /* We need this temp string because focus_out and im_reset seems to change the committed text->text values. So the idea is to restore the original value of text->text after gtk_im_* calls*/ const char *temp_text = NULL; if (text->text) temp_text = g_strdup(text->text); gtk_im_context_focus_out(text->im_context); gtk_im_context_reset(text->im_context); g_signal_handlers_disconnect_matched (text->im_context, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, text); text->im_context_signals_registered = FALSE; if (text->revert) { if (strcmp(text->revert, text->text) || text->preedit_len) { /* Time to update the EText string! We are updating the EText display if current text does not matches revert text of if preedit is not zero. */ e_text_model_set_text(text->model, temp_text); } } if (temp_text) g_free (temp_text); }