From 0748983805504d67679233df24255f1ca3154582 Mon Sep 17 00:00:00 2001 From: handa Date: Tue, 21 Dec 2004 12:30:07 +0000 Subject: [PATCH] (ButtonProc): Reset the current input method (if activated) and insert the produced text. (KeyProc): Cancel the previous change. --- example/medit.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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 (); -- 1.7.10.4