How to create a working GtkIMContextSimple


the subject may not fully do the content justice, it just describes the
actual reason why I'm where I am: My goal is to create an IMContext
which basically only serves as a "Hook" to perform certain operations
when a GtkEntry (or anything which uses an IMM) is focused but, at least
in large portions, does not affect the actual input.

Meaning my IMContext should get activated/used, but I want to rely on
the otherwise would-have-been-selected context (like "Simple") to actual
perform all input-related computations.

GtkIMMulticontext basically already does this. It is a fully functional
class by itsself and just links up with whatever other IMContext is

There I've run into a few practical problems and trying to understand
the code of IMMulticontext (IMMC) I just got more confused.

The practical problem is that I, in my IMM, need to figure out

a) which other IMs are available
b) which is the next less preferred IM to the mine
c) instantiate it and
d) link up with it (meaning forward all requests to it, like IMMC does)

While d) should practically pose no difficulty and just a bit a tedious
code, a) through c) seem very problematic. In particular

a) At first, the documentation makes no mention whatsoever about the
currently loadable/loaded IMModules/IMContexts are maintained or how to
access a list of available IMMs. Only GtkIMContextSimple is readily
available. The code


contains a call to _gtk_im_module_list() which appears to be part of a
private API which no IM may rely on. Therefore, I may obtain a list of
modules only through call to a factually non-existant API

b) Same here - is there any way to obtain the "next-best" IMM from that
list, assuming I had found a way to obtain it?

c) This is equally problematic. Even if I were to ignore a) and b) and
would just go with GtkIMContextSimple, I still don't know how to
instantiate that. The documentation makes a remark about it being a
"table based" input which would require some sort of "table" to work.
I've no idea what to make of that and there appears not to be any
further documentation of how this works.

As I said, these are the practical problems. Trying to find the solution
to which in gtkimmulticontext.c, then, seemed to raise more questions
than it solved. Particularly, I thought, I'd start off from
: gtk_im_multicontext_set_context_id

hoping this would eventually tell me where the multicontext keeps its
"slaves" arround. What I found, however, left me clueless:


...resets the slave - understood
...frees priv->context_id_aux - understood
...fills it with the requested id - understood
...calls gtk_im_multicontext_set_slave with (context,NULL,FALSE)

This is where things don't seem to match up: In ...set_slave it does
nothing but disconnect the signals from the previously set slave?!

I thought it would resolve the requested context_id_aux string to a
certain context and set that as slave (which would have told me where
the slave comes from, and subsequently how it's instantiated) but
nothing of that sorts happens.

Therefore I'm out of ideas now. Could anyone help me with achieving my
original goal?

Thank you in advance

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