Comment #4 on issue 1291 by [email protected]: Problem at typing latest Korean letter
http://code.google.com/p/ibus/issues/detail?id=1291

This bug is so annoying, and I tried to figure out what's happening inside. Well, I have ABSOLUTELY ZERO knowledge on the ibus archtecture, just hoping that the following result has any meaning for bug fix.

I used gtk2 client and leafpad application (just a kind of nodepad) while testing.


1. The problem occurs only when the environment variable IBUS_ENABLE_SYNC_MODE is set.

As said in the Launchpad report, this bug affects Unity only. IMTextEntry::IMTextEntry() method in the Unity code sets the variable to "1" before setting up an input method. Unity 2D doesn't set it. Neither does Gnome, I guess.


2. Callbacks in the client code are called in different orders.

Some debugging codes were added to gtk2 client code and ibug-hangul code. Then, I opened a leafpad window and type in "ㄱ", "ㅏ", "ㄴ", "ㅏ", and " ". It results "가 나" on the Unity, but "가나 " on the Unity 2D.

Function calls on the Unity 2D environment:

    ('ㄱ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=107, keycode=45
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='', preedit_visible=0, text='ㄱ', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=107, keycode=45

    ('ㅏ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='ㄱ', preedit_visible=1, text='가', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41
    leafpad: _key_snooper_cb: state=0x2000000, keyval=102, keycode=41

    ('ㄴ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=104, keycode=43
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1
    leafpad: _ibus_context_commit_text_cb: text='가'
leafpad: _ibus_context_update_preedit_text_cb: preedit_string='가', preedit_visible=1, text='ㄴ', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=104, keycode=43
    leafpad: _key_snooper_cb: state=0x2000000, keyval=104, keycode=43

    ('ㅏ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='ㄴ', preedit_visible=1, text='나', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41
    leafpad: _key_snooper_cb: state=0x2000000, keyval=102, keycode=41

    (' ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=32, keycode=65
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 0
    ibus-engine-hangul: ibus_hangul_engine_flush: str=''
    leafpad: _ibus_context_commit_text_cb: text='나'
leafpad: _ibus_context_update_preedit_text_cb: preedit_string='나', preedit_visible=1, text='', cursor_pos=0, visible=0 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='', preedit_visible=0, text='', cursor_pos=0, visible=0
    leafpad: _key_snooper_cb: state=0x2000000, keyval=32, keycode=65
    leafpad: _slave_commit_cb: string=' '
    leafpad: _key_snooper_cb: state=0x0, keyval=32, keycode=65
    leafpad: _key_snooper_cb: state=0x2000000, keyval=32, keycode=65

Function calls on the Unity environment:

    ('ㄱ' pressed)
    leadpad: _key_snooper_cb: state=0x0, keyval=107, keycode=45
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='', preedit_visible=0, text='ㄱ', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=107, keycode=45

    ('ㅏ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='ㄱ', preedit_visible=1, text='가', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41

    ('ㄴ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=104, keycode=43
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1
    leafpad: _ibus_context_commit_text_cb: text='가'
leafpad: _ibus_context_update_preedit_text_cb: preedit_string='가', preedit_visible=1, text='ㄴ', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=104, keycode=43

    ('ㅏ' pressed)
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 1 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='ㄴ', preedit_visible=1, text='나', cursor_pos=1, visible=1
    leafpad: _key_snooper_cb: state=0x0, keyval=102, keycode=41

    (' ' pressed)
    _key_snooper_cb: state=0x0, keyval=32, keycode=65
ibus-engine-hangul: ibus_hangul_engine_process_key_event: hangul_ic_process returned 0
    ibus-engine-hangul: ibus_hangul_engine_flush: str=''
    leafpad: _slave_commit_cb: string=' '
    leafpad: _ibus_context_commit_text_cb: text='나'
leafpad: _ibus_context_update_preedit_text_cb: preedit_string='나', preedit_visible=1, text='', cursor_pos=0, visible=0 leafpad: _ibus_context_update_preedit_text_cb: preedit_string='', preedit_visible=0, text='', cursor_pos=0, visible=0
    leafpad: _key_snooper_cb: state=0x0, keyval=32, keycode=65

You can see that:

a. _key_snooper_cb() is called more on Unity 2D, with IBUS_FORWARD_MASK (== IBUS_IGNORED_MASK) flag set in event->state. It seems to be just a result of the environment IBUS_ENABLE_SYNC_MODE.

b. _slave_commit_cb() is called BEFORE _ibus_context_commit_text_cb() on Unity. Both callbacks send a commit signal with the passed text, so COMMIT(" ") signal is sent first, and then COMMIT("나") is sent. I guess that's why I got "가 나" instead of "가나 ". But I couldn't figure out why _slave_commit_cb() is called first on the Unity only.


Well... That's the end of story, and I couldn't go deeper, at least for now. Is there anything else that I can help to fix this bug? :-)

--
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

回复