Re: Changing the default input method



On Fri, 2007-01-19 at 19:32 +0530, Anupama Chandwani wrote:
> On 1/18/07, Murray Cumming <murrayc murrayc com> wrote:
> > On Fri, 2006-12-22 at 19:20 +0530, Anupama Chandwani wrote:
> > > >
> > > >How can I change the default GTK+ input method used by a system? I've
> > > >seen mention of the GTK_IM_MODULE enviroment variable, but it does not
> > > >seem to have any effect.
> > > >
> >
> > Sorry for the late reply. I didn't see your email because it only went
> > to the list. I know some people like that.
> 
> I had you in my To: list & gtk-list as cc:
> Mayb it went in your bulk or spam
> 
> > > In gtkimcontextsimple.c there is a variable "global_context_id"
> >
> > This is actually in gtkimmulticontext.c, which handles the right-click
> > menu of all input methods. However, it is a static variable, so it can
> > not be used from any other file or library.
> 
> Yes its a static variable in gtkimmulticontext.c, but in a text widget
> like GtkEntry (or GtkTextView)
> GtkEntry->im_context->context_id = global_context_id (static variable char*)
> So when a gtk_im_multicontext_new() is allocated to
> gtkentry->im_context, its takes the context_id from this static
> variable.

Yes, though the code actually looks like this, in GtkEntry:

entry->im_context = gtk_im_multicontext_new ();

It doesn't (and couldn't) access global_context_id directly, but
global_context_id is used by gtk_im_multicontext_new().

> > Did you manage to actually change this variable somehow, without
> > patching GTK+ itself?
> 
> I have changed this variable by assigning it my module name (as
> suggested in prev mail) statically before compiling.

Is your input method source code online somewhere.

[snip]
> > However, this would force the use of the input method by default for all
> > widgets and all applications.
> >I can do that more simply by just using
> > "*" for the locale in the GtkIMContextInfo struct when the input method
> > registers itself.
> >
> 
> That might work, havent tried.

It does.

> > But I would like for the application to choose the input method for some
> > widgets at runtime.

For instance, with a keyboard that has only numbers, I'd like text-input
GtkEntry widgets to use my multipress method to enter alphanumeric text,
but number-entry GtkEntry widgets should use the normal input method to
enter numeric digits.
 
I think I'll have to add some API to GTK+ for this.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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