Monday, November 9, 2009

working with key event

There's one thing that I'm stuck.

I would like the preedit window to pop up as you type, in the CJK mode. It shouldn't be there all the time. Currently, when I type in "watashi", the character "w" is sent to both the client and the cjk-preedit window. This results in "wわたし" in the client.

As soon as the CJK mode is on, I would like the client to avoid receiving the key events, but HIM plugin doesn't allow me to propagate gdk events. I haven't been able to come up with a good solution for this problem. I tried key_snooper and gtk_invisible, but both aren't good enough.

The best workaround may be to send the backspace to the client just like as follows as in this example.

However, this doesn't work with the browser. This is because for the browser (or any custom gtk input widgets), the example code results in XFakeKeyEvent (Backspace) to the root window and naturally IBus is forced to swallow the Backspace unnecessarily.
I guess this entry is for me to get some structure in my thinking.