From: handa Date: Fri, 16 Sep 2005 11:51:20 +0000 (+0000) Subject: (ButtonProc): Don't reset ic, instead send X-Git-Tag: REL-1-3-0~167 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31b7efe8e9246bd7bc2eea2b08682195268fecf0;p=m17n%2Fm17n-lib.git (ButtonProc): Don't reset ic, instead send Minput_focus_move event to the current input method. (FocusInProc, FocusOutProc): New functions. (actions): Add elements for FocusIn and FocusOut. (main): Add elements for FocusIn and FocusOut to trans2. --- diff --git a/example/medit.c b/example/medit.c index cf7aa7c..ea60f2e 100644 --- a/example/medit.c +++ b/example/medit.c @@ -1252,12 +1252,12 @@ ButtonProc (Widget w, XEvent *event, String *str, Cardinal *num) redraw (sel_start.y0, sel_end.y1, 1, 0); } hide_cursor (); - if (current_input_context) + if (current_input_context + && minput_filter (current_input_context, Minput_focus_move, NULL) == 0) { MText *produced = mtext (); - minput_reset_ic (current_input_context); - minput_lookup (current_input_context, Mnil, NULL, produced); + minput_lookup (current_input_context, Mnil, NULL, produced); if (mtext_len (produced) > 0) { insert_chars (produced); @@ -1410,6 +1410,42 @@ ButtonMoveProc (Widget w, XEvent *event, String *str, Cardinal *num) } void +FocusInProc (Widget w, XEvent *event, String *str, Cardinal *num) +{ + if (current_input_context + && minput_filter (current_input_context, Minput_focus_out, NULL) == 0) + { + MText *produced = mtext (); + + minput_lookup (current_input_context, Mnil, NULL, produced); + if (mtext_len (produced) > 0) + { + hide_cursor (); + insert_chars (produced); + } + m17n_object_unref (produced); + } +} + +void +FocusOutProc (Widget w, XEvent *event, String *str, Cardinal *num) +{ + if (current_input_context + && minput_filter (current_input_context, Minput_focus_out, NULL) == 0) + { + MText *produced = mtext (); + + minput_lookup (current_input_context, Mnil, NULL, produced); + if (mtext_len (produced) > 0) + { + hide_cursor (); + insert_chars (produced); + } + m17n_object_unref (produced); + } +} + +void ScrollProc (Widget w, XtPointer client_data, XtPointer position) { int from; @@ -2457,7 +2493,9 @@ XtActionsRec actions[] = { {"ButtonRelease", ButtonReleaseProc}, {"ButtonMotion", ButtonMoveProc}, {"Button2Press", Button2Proc}, - {"MenuHelp", MenuHelpProc} + {"MenuHelp", MenuHelpProc}, + {"FocusIn", FocusInProc}, + {"FocusOut", FocusOutProc} }; @@ -2507,7 +2545,9 @@ main (int argc, char **argv) : Button2Press()"; /* Translation table for the top form widget. */ String trans2 = ": Key()\n\ - : Key()"; + : Key()\n\ + : FocusIn()\n\ + : FocusOut()"; String pop_face_trans = ": MenuHelp(Pop face property) highlight()\n\ : MenuHelp() reset()\n\