I have talked with Su Zhe about this bug. He said this trigger hot key should be
handled in IMEs. I think it means each IME should be update except it has
handled this hot key.
I wrote a test patch, just make IC reset when the IME is deactived. It seems
work well. But Su Zhe think it's not a good way, because reset() has special usage.
Below is my patch for reference :
--- gtkimcontextscim.cpp.orig 2005-12-06 10:11:27.732624776 +0800
+++ gtkimcontextscim.cpp 2005-12-02 15:36:36.000000000 +0800
@@ -1256,8 +1256,10 @@
if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER) {
if (!ic->impl->is_on)
turn_on_ic (ic);
- else
+ else {
turn_off_ic (ic);
+ ic->impl->si->reset(); //qshen
+ }
ret = true;
} else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) {
if (!ic->impl->is_on)

I think it's better to handle this deactivate/activate hot key in frontend/gtkim
moudle, because it's a global setting for frontend. We can set it in SCIM setup
window | frontend | global setting. The common setting for this hot key is
"Control+space".
SCIM gtkim moudle names this hotkey as SCIM_CONFIG_HOTKEYS_FRONTEND_TRIGGER, and
handles it in filter_hotkeys() . The X11 frontend has similar handling code for
this hotkey.
We konw that preedit string is managed by IC. Gtk-im transfer IC to SCIM, SCIM
transfer IC to IME instance. IME can be accessed through IME APIs, but the only
API to handle preedit string is reset() .
So there are 2 choices to handle this bug. One is using reset() in
frontend/gtkim module, Another is handling the hotkey in IME inside.

This behaviour should be implemented in each IMEngine.
When scim is deactivated, the focus_out () method will be invoked, then IMEngine
may do anything in this method, for example clearing the preedit string.