From: handa Date: Wed, 9 Mar 2011 05:45:49 +0000 (+0000) Subject: (take_action_list): Move the handling of candidate-list X-Git-Tag: REL-1-6-3-RC~8 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=02c5d90ea3694c6fa6422de2ad4cbdfda46ce854;p=m17n%2Fm17n-lib.git (take_action_list): Move the handling of candidate-list change to the function filter. (filter): Adjusted as above. --- diff --git a/src/input.c b/src/input.c index 6e0c2d8..2de5547 100644 --- a/src/input.c +++ b/src/input.c @@ -3004,9 +3004,6 @@ static int take_action_list (MInputContext *ic, MPlist *action_list) { MInputContextInfo *ic_info = (MInputContextInfo *) ic->info; - MPlist *candidate_list = ic->candidate_list; - int candidate_index = ic->candidate_index; - int candidate_show = ic->candidate_show; MTextProperty *prop; MPLIST_DO (action_list, action_list) @@ -3480,31 +3477,6 @@ take_action_list (MInputContext *ic, MPlist *action_list) }; } } - - if (ic->candidate_list) - { - M17N_OBJECT_UNREF (ic->candidate_list); - ic->candidate_list = NULL; - } - if (ic->cursor_pos > 0 - && (prop = mtext_get_property (ic->preedit, ic->cursor_pos - 1, - Mcandidate_list))) - { - ic->candidate_list = mtext_property_value (prop); - M17N_OBJECT_REF (ic->candidate_list); - ic->candidate_index - = (int) mtext_get_prop (ic->preedit, ic->cursor_pos - 1, - Mcandidate_index); - ic->candidate_from = mtext_property_start (prop); - ic->candidate_to = mtext_property_end (prop); - } - - if (candidate_list != ic->candidate_list) - ic->candidates_changed |= MINPUT_CANDIDATES_LIST_CHANGED; - if (candidate_index != ic->candidate_index) - ic->candidates_changed |= MINPUT_CANDIDATES_INDEX_CHANGED; - if (candidate_show != ic->candidate_show) - ic->candidates_changed |= MINPUT_CANDIDATES_SHOW_CHANGED; return 0; } @@ -3914,7 +3886,37 @@ filter (MInputContext *ic, MSymbol key, void *arg) ic_info->key_unhandled = 0; do { - if (handle_key (ic) < 0) + MPlist *candidate_list = ic->candidate_list; + int candidate_index = ic->candidate_index; + int candidate_show = ic->candidate_show; + MTextProperty *prop; + int result = handle_key (ic); + + if (ic->candidate_list) + { + M17N_OBJECT_UNREF (ic->candidate_list); + ic->candidate_list = NULL; + } + if (ic->cursor_pos > 0 + && (prop = mtext_get_property (ic->preedit, ic->cursor_pos - 1, + Mcandidate_list))) + { + ic->candidate_list = mtext_property_value (prop); + M17N_OBJECT_REF (ic->candidate_list); + ic->candidate_index + = (int) mtext_get_prop (ic->preedit, ic->cursor_pos - 1, + Mcandidate_index); + ic->candidate_from = mtext_property_start (prop); + ic->candidate_to = mtext_property_end (prop); + } + if (candidate_list != ic->candidate_list) + ic->candidates_changed |= MINPUT_CANDIDATES_LIST_CHANGED; + if (candidate_index != ic->candidate_index) + ic->candidates_changed |= MINPUT_CANDIDATES_INDEX_CHANGED; + if (candidate_show != ic->candidate_show) + ic->candidates_changed |= MINPUT_CANDIDATES_SHOW_CHANGED; + + if (result < 0) { /* KEY was not handled. Delete it from the current key sequence. */ if (ic_info->used > 0)