Theppitak Karoonboonyanan <[email protected]> writes:
> I've tried applying the patch to 1.3.3-1 without the configuration parts.
> (See the attached patch.) It works quite well for me when switching IMs.
> However, the problem is it double-commits the preedit text when
> focused out.
>
> For example, when I type "ที่" and then immediately switch to another
> window, the preedit "ที่" is committed twice and becomes "ที่ที่".
Thanks for testing. Yes, I encountered the same problem, but it doesn't
happen always. I guess this is a timing problem between when ibus
handles focus-out and when m17n-lib handles focus-out. I'm attaching a
patch based on yours.
--- a/src/engine.c
+++ b/src/engine.c
@@ -34,6 +34,7 @@
guint preedit_background;
gint preedit_underline;
gint lookup_table_orientation;
+ gint focus_out_behavior;
MInputMethod *im;
};
@@ -256,6 +257,7 @@
klass->preedit_background = INVALID_COLOR;
klass->preedit_underline = IBUS_ATTR_UNDERLINE_NONE;
klass->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
+ klass->focus_out_behavior = IBUS_ENGINE_PREEDIT_COMMIT;
engine_config = ibus_m17n_get_engine_config (engine_name);
g_free (engine_name);
@@ -492,10 +494,11 @@
klass->preedit_background, 0, -1);
ibus_text_append_attribute (text, IBUS_ATTR_TYPE_UNDERLINE,
klass->preedit_underline, 0, -1);
- ibus_engine_update_preedit_text ((IBusEngine *) m17n,
- text,
- m17n->context->cursor_pos,
- mtext_len (m17n->context->preedit) > 0);
+ ibus_engine_update_preedit_text_with_mode ((IBusEngine *) m17n,
+ text,
+ m17n->context->cursor_pos,
+ mtext_len (m17n->context->preedit) > 0,
+ klass->focus_out_behavior);
}
}
@@ -676,7 +679,7 @@
{
IBusM17NEngine *m17n = (IBusM17NEngine *) engine;
- ibus_m17n_engine_process_key (m17n, Minput_focus_out);
+ minput_reset_ic (m17n->context);
parent_class->focus_out (engine);
}
Regards,
--
Daiki Ueno