On 1/18/07, Murray Cumming <murrayc@xxxxxxxxxxx> 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. > > 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. > > > which > > maintains the input method of gtk. Setting that to "myinputmethod" > > will help you have it as default. But do this after initialisation of > > the module, else it will give a undefined refrence to you input > > method. > > I guess you are somehow managing to do this by doing it in the module > itself, which might be OK because the symbol would not be linked until > the input module was loaded. Yes the module code takes care of initialisation. > 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. > But I would like for the application to choose the input method for some > widgets at runtime. > Yes, It changes the input method for all applications if the hardcore change is made in the gtkimmulticontext.c, but if you assign it at runtime on right click, it changes only for the particular app. The procedure that i described also adds "myinputmethod" in the right button menu. So it can be choosen runtime if not assigned as default. > > >For instance, I've tried > > >export GTK_IM_MODULE="myinputmethod";gtk-demo > > > > > >Also, is there any way to change this at runtime, with a C function > > >call? > > -- > Murray Cumming > murrayc@xxxxxxxxxxx > www.murrayc.com > www.openismus.com > > -- Anupama Chandwani Celunite Soft Technologies 3rd Floor, Business Avenue Koregaon Park Pune, MS 411001 INDIA _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list