[Uim] question about function uim_reset_context() (was: uim 0.4.5 released)

Mike FABIAN mfabian at suse.de
Thu Dec 16 19:39:21 EET 2004


TOKUNAGA Hiroyuki <tkng at xem.jp> さんは書きました:

>  uim-0.4.5 is now available for download at:

I have a question concerning the function uim_reset_context() in
uim-0.4.5 svn revision 1650. The header file uim.h says
about this function:

    /**
     * Reset input context.
     * Pending string might be committed and preedit string might be erased. (Not yet implemented so)
     *
     * @param uc input context to reset
     */
    void
    uim_reset_context(uim_context uc);

I added a call to this function from scim-uim to the focus_out()
method

    UIMInstance::focus_out ()
    {
        SCIM_DEBUG_IMENGINE(2) << "focus_out.\n";

       // commit pending preedit strings:
       uim_reset_context(m_uc); 

    }

which is called when the input method is switched off (with
Shift+Space or Control+Space) or when the focus is moved to a
different application.

I tried this because I wanted to commit the current preedit string
when the input method is switched off.  I believe this is more natural
behavior. And it behaves like this when uim is used via uim-xim,
GTK_IM_MODULE or QT_IM_MODULE. In these three cases, the current
preedit string is committed when the input method is switched off.

Only when using scim-uim it is different. With scim-uim, currently the
preedit string disappears when switching off the input method but it
is remembered and appears again when the input method is switched on
again. It is quite confusing when a previously edited preedit string
suddenly appears again after one has typed Latin letters for a
while.

So I wanted to make scim-uim behave like the other variants
of using uim and added the call to uim_reset_context(m_uc)
to UIMInstance::focus_out ().

Unfortunately this doesn't fix the problem.  After applying this
change, the preedit string still isn't committed when switching off
the input method. And it still comes back when switching the input
method on although the old preedit string disappears as soon as one
continues typing. I.e. effectively the old preedit string is
discarded, it only briefly appears again after switching the input
method on again and is then immediately discarded when the first new
key is typed.

Probably the reason is that uim_reset_context() isn't yet
completely implemented, just as the comment in uim.h says.
What must be added to uim_reset_context() to make it really
commit the pending preedit string and then erase it?
Currently, uim_reset_context() looks like this:

    void
    uim_reset_context(uim_context uc)
    {
       UIM_EVAL_FSTRING1(uc, "(reset-handler %d)", uc->id);

       /* delete all preedit segments */
       uim_release_preedit_segments(uc);
    }

I tried to add something like

    uc->commit_cb(uc->ptr, s);

but apparently that doesn't work and I don't know how to access
the current preedit string to give it as an argument to commit_cb().
The structure uim_context_ in context.h doesn't seem
to contain the complete preedit string, only preedit segments.

How does this work in uim?

-- 
Mike FABIAN   <mfabian at suse.de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。



More information about the uim mailing list