On Tue, Feb 28, 2012 at 4:41 PM, Daiki Ueno <u...@unixuser.org> wrote:

> OK, proposed patch:
>
> https://github.com/ueno/ibus-m17n/commit/63d1e981
>
> Though there I have added a config option for the focus out behavior,
> perhaps it might be sufficient for most ibus-m17n IMEs to always commit
> preedit text.

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 "??????".

Regards,
-- 
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/
Index: ibus-m17n-1.3.3/src/engine.c
===================================================================
--- ibus-m17n-1.3.3.orig/src/engine.c	2011-08-29 14:44:20.000000000 +0700
+++ ibus-m17n-1.3.3/src/engine.c	2012-02-29 11:05:20.000000000 +0700
@@ -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);
     }
 }
 

Reply via email to