Comment #14 on issue 1420 by takao.fujiwara1: When I use ibus-hangul, the lastly typed character can be copied to another edit box
http://code.google.com/p/ibus/issues/detail?id=1420

Probably it's an idea to remove all contents in ibus_hangul_engine_flush():
https://github.com/fujiwarat/ibus-hangul/commit/851610f3eae8424baa9083c7ef9df38f0714038d

I tried another way in ibus-hangul.

--- engine.c.orig
+++ engine.c
@@ -1076,15 +1087,23 @@ ibus_hangul_engine_flush (IBusHangulEngi
-       str = ustring_begin (hangul->preedit);
-       text = ibus_text_new_from_ucs4 (str);
-       ibus_engine_commit_text ((IBusEngine *) hangul, text);
+        input_context = ibus_bus_current_input_context (hangul->bus);
+        if (g_strcmp0 (input_context, hangul->input_context) == 0) {
+            str = ustring_begin (hangul->preedit);
+            text = ibus_text_new_from_ucs4 (str);
+            ibus_engine_commit_text ((IBusEngine *) hangul, text);
+        }

@@ -1109,6 +1128,8 @@ ibus_hangul_engine_focus_in (IBusEngine
         ibus_hangul_engine_update_lookup_table_ui (hangul);
     }

+    hangul->input_context = ibus_bus_current_input_context (hangul->bus);
+
     parent_class->focus_in (engine);
 }

@@ -1128,6 +1154,10 @@ ibus_hangul_engine_focus_out (IBusEngine
         ibus_engine_hide_auxiliary_text (engine);
     }

+    hangul->input_context = NULL;
+
     parent_class->focus_out ((IBusEngine *) hangul);
 }


This commit the preedit text only if the input contexts are same between focus-in and reset fuctions. But this also does not work because the reset() is called before focus-in() is called so the address of the input context is old and the ibus_engine_commit_text() is always called against my expectation.

Probably I think there is no way to resolve this in ibus side.

The reset() is called by firefox:

#0  ibus_im_context_reset (context=0x7f4207de6700) at ibusimcontext.c:832
#1 0x00007f42219f5960 in nsGtkIMModule::ResetInputState (this=0x7f420bdcf310,
    aCaller=0x7f420ba5dd00)
at /root/rpmbuild/BUILD/xulrunner-13.0/mozilla-release/widget/gtk2/nsGtkIMModule.cpp:509 #2 0x00007f422164e745 in nsEditor::ForceCompositionEnd (this=0x7f420bd754b0) at /root/rpmbuild/BUILD/xulrunner-13.0/mozilla-release/editor/libeditor/base/nsEditor.cpp:2025
#3  0x00007f42216583ac in nsEditorEventListener::MouseDown (
    this=<optimized out>, aMouseEvent=<optimized out>)
at /root/rpmbuild/BUILD/xulrunner-13.0/mozilla-release/editor/libeditor/base/nsEditorEventListener.cpp:607
#4  0x00007f422165a00e in nsEditorEventListener::HandleEvent (this=
    0x7f42089e6100, aEvent=0x7f42089de700)
at /root/rpmbuild/BUILD/xulrunner-13.0/mozilla-release/editor/libeditor/base/nsEditorEventListener.cpp:343

If the reset() is called by firefox after focus-out() and/or focus-in() is called, I think this problem can be fixed with ibus_engine_commit_text().

--
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en

回复