From: handa Date: Tue, 21 Dec 2004 12:30:07 +0000 (+0000) Subject: (ButtonProc): Reset the current input method (if X-Git-Tag: REL-1-2-0~32 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=0748983805504d67679233df24255f1ca3154582;p=m17n%2Fm17n-lib.git (ButtonProc): Reset the current input method (if activated) and insert the produced text. (KeyProc): Cancel the previous change. --- diff --git a/example/medit.c b/example/medit.c index 320b366..dc9bea6 100644 --- a/example/medit.c +++ b/example/medit.c @@ -1184,6 +1184,20 @@ ButtonProc (Widget w, XEvent *event, String *str, Cardinal *num) redraw (sel_start.y0, sel_end.y1, 1, 0); } hide_cursor (); + if (current_input_context) + { + MText *produced = mtext (); + + minput_reset_ic (current_input_context); + minput_lookup (current_input_context, Mnil, NULL, produced); + if (mtext_len (produced) > 0) + { + insert_chars (produced); + if (pos >= cursor.from) + pos += mtext_len (produced); + } + m17n_object_unref (produced); + } update_cursor (pos, 0); } @@ -1588,13 +1602,6 @@ KeyProc (Widget w, XEvent *event, String *str, Cardinal *num) redraw (0, win_height, 1, 1); return; } - else if (buf[0] == 28) /* C-\ */ - { - if (current_input_context) - minput_reset_ic (current_input_context); - if (mtext_len (current_input_context->produced) > 0) - insert_chars (current_input_context->produced); - } else { MText *temp = mtext ();