Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] im-ja: A Japanese input module for GTK2



Ryan Shaw wrote:

> On Mon, 2003-02-17 at 15:16, Botond Botyanszki wrote:
>
> > Last week I have been bored at my lab, so I have hacked together a Japanese
> > input module for GTK2 (and thus GNOME2).
>
> Could you explain a bit about how this works? If I
> understand correctly, GTK2 apps are supposed to be
> to dynamically load different input modules.

Correct. There is a simple (GtkIMContextSimple) and a more complicated API that
GTK2 input modules have to implement. The latter
(http://developer.gnome.org/doc/API/2.0/gtk/GtkIMContext.html) can be used to
implement CJK input methods.

When the lib is compiled and ready, the `gtk-query-immodules-2.0` program can be
used to get the info about the module.
This is what needs to be added to /etc/gtk-2.0/gtk.immodules. Looks like this:
"/home/boti/im-ja/im-ja.so"
"im-ja" "Japanese" "gtk+" "" "ja"

Basically it contains the path to the module, on the next line it has a symbolic
name, the string that shows up in the gui for the input method, the locale it is
intended for.

> ..but
> how does the user set which input module he wants
> to use? Is this set on an app-by-app basis, or
> systemwide?

Gtk2 decides automatically, which is pretty simple:
It queries the current locale and finds a suitable module intended to be used
for that languge (based on the last field), then sets it as the default input
method.
In the above case if I start a gtk2 prog with LC_ALL=ja_JP, then im-ja will be
the default. If the locale field is empty, then this automagic won't be used.
On gtk2 widgets that support text input, the input method is selectable through
a menu that comes up on the right mouse click. Through this interface it's
possible to select any input method under any locale.
Systemwide configuration is the above mentioned way, and the default input
module can be set through an environment variable (GTK_IM_MODULE).


> It will be really great when we can ditch kinput2
> once and for all. Thanks for your work.

As I mentioned before, im-ja has it's biggest disadvantage: it's only for gtk2.
Plus something smarter than canna input mode needs to be implemented for im-ja.
While developing the canna input mode, I realized how old (=stupid) the client
side canna  api is. I frequently tested kinput2 with canna, how it'd compare to
im-ja. It was pretty relieving to see that it died and was useless just as
frequently as mine (Anyone using canna with kinput2 ?)
So the freewnn binding is very high priority. I haven't looked much yet, if
anyone knows good docs or sample source for [free]wnn, then please let me know.
And also it would be cool if somebody would like to participate in the effort.







Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links