diff options
author | Milan Crha <mcrha@redhat.com> | 2010-11-24 01:08:50 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-11-24 01:08:50 +0800 |
commit | 64966f87895156b441738a617d66297f492d4cb2 (patch) | |
tree | 11d399be7f84ce40e8ee8836da4730901d92b8f0 /widgets | |
parent | 12c0f810e2267ba639f72c0a97acb651735d7389 (diff) | |
download | gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.tar gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.tar.gz gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.tar.bz2 gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.tar.lz gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.tar.xz gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.tar.zst gsoc2013-evolution-64966f87895156b441738a617d66297f492d4cb2.zip |
Reset IM context when entering ECellText editing
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-cell-text.c | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 6ff43f1264..87febf7c09 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -872,47 +872,8 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col break; case GDK_KEY_PRESS: /* Fall Through */ if (edit_display) { - if (edit->im_context && - !edit->im_context_signals_registered) { - - g_signal_connect (edit->im_context, - "preedit_changed", - G_CALLBACK (\ - e_cell_text_preedit_changed_cb), - text_view); - - g_signal_connect (edit->im_context, - "commit", - G_CALLBACK (\ - e_cell_text_commit_cb), - text_view); - - g_signal_connect (edit->im_context, - "retrieve_surrounding", - G_CALLBACK (\ - e_cell_text_retrieve_surrounding_cb), - text_view); - - g_signal_connect (edit->im_context, - "delete_surrounding", - G_CALLBACK (\ - e_cell_text_delete_surrounding_cb), - text_view); - - edit->im_context_signals_registered = TRUE; - } - edit->show_cursor = FALSE; - } else { - if (edit && edit->im_context) { - g_signal_handlers_disconnect_matched ( - edit->im_context, - G_SIGNAL_MATCH_DATA, 0, 0, - NULL, NULL, edit); - edit->im_context_signals_registered = FALSE; - } - ect_stop_editing (text_view, TRUE); } return_val = TRUE; @@ -1170,6 +1131,19 @@ ect_enter_edit (ECellView *ecell_view, gint model_col, gint view_col, gint row) e_cell_text_free_text (ect, temp); edit->text = g_strdup (edit->old_text); + if (edit->im_context) { + gtk_im_context_reset (edit->im_context); + if (!edit->im_context_signals_registered) { + g_signal_connect (edit->im_context, "preedit_changed", G_CALLBACK (e_cell_text_preedit_changed_cb), text_view); + g_signal_connect (edit->im_context, "commit", G_CALLBACK (e_cell_text_commit_cb), text_view); + g_signal_connect (edit->im_context, "retrieve_surrounding", G_CALLBACK (e_cell_text_retrieve_surrounding_cb), text_view); + g_signal_connect (edit->im_context, "delete_surrounding", G_CALLBACK (e_cell_text_delete_surrounding_cb), text_view); + + edit->im_context_signals_registered = TRUE; + } + gtk_im_context_focus_in (edit->im_context); + } + #if 0 if (edit->pointer_in) { if (edit->default_cursor_shown) { @@ -1193,6 +1167,14 @@ ect_leave_edit (ECellView *ecell_view, gint model_col, gint view_col, gint row, CellEdit *edit = text_view->edit; if (edit) { + if (edit->im_context) { + gtk_im_context_focus_out (edit->im_context); + + if (edit->im_context_signals_registered) { + g_signal_handlers_disconnect_matched (edit->im_context, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, edit); + edit->im_context_signals_registered = FALSE; + } + } ect_stop_editing (text_view, TRUE); } else { /* |