else { /* 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. Defaulting temp_text to "" wont hurt as in worst case, text model also returns "" :) */ const char *temp_text = ""; int allocated = 0; if (text->text) { temp_text = g_strdup(text->text); allocated = 1; } 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. In first case, text->text will always give us the committed string, while in latter case, just reverting to latest text->text would do the trick */ e_text_model_set_text(text->model, temp_text); } } if (allocated) g_free(temp_text); } e_text_stop_editing (text); if (text->timeout_id) { g_source_remove(text->timeout_id); text->timeout_id = 0; } if (text->show_cursor || text->draw_borders) { text->show_cursor = FALSE; text->needs_redraw = 1; gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); } }