[maemo-developers] Word completion in Fremantle
From: Cornelius Hald hald at icandy.deDate: Sat Nov 7 18:11:48 EET 2009
- Previous message: Word completion in Fremantle
- Next message: Word completion in Fremantle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Felipe, your information helped me a lot to understand what's going on behind the scene, so it's not black magic anymore ;) Unfortunately I see no way of getting an instance of HildonIMContext or GtkIMContext. I checked GdkWindow, GtkWidget, GtkTextBuffer and GtkTextView, but non of them let me retrieve the IMContext. To me it looks like the IMContext knows the text widget, but not the other way around. Do you know a way to get the IMContext? I also checked where the "preedit-changed" signal is handled and followed this back to GtkTextView and GtkLayout but found no way of intercepting it. Also there is a GtkTextMark called "preedit" used and I can listen to changes of this mark, but unfortunately this does not give me enough information. I think I really need that HildonIMContext instance. It would be great if you have an idea how to get it. Thanks a lot! Conny P.S. Maybe I could use a signal emission hook to intercept the "preedit-changed" signal. Not sure, but it could work. I'll give it a try... On Fri, 2009-11-06 at 19:43 +0000, Felipe Erias Morandeira wrote: > Hi, > > take a look at set_preedit_buffer() in HildonIMContext: > > https://stage.maemo.org/svn/maemo/projects/haf/trunk/hildon-input-method-framework/src/hildon-im-context.c > > In a nutshell, the preedit text is set by emitting the "preedit-changed" > signal in the HildonIMContext (which extends GtkIMContext). You could > probably try to get a reference to the context and then either listen to > this signal or use gtk_im_context_get_preedit_string(). > > static void > set_preedit_buffer (HildonIMContext *self, const gchar* s) > { > [...] > > if (s != NULL) > { > [...] > > self->show_preedit = TRUE; > g_signal_emit_by_name(self, > "preedit-changed", > self->preedit_buffer->str); > > [...] > } > else > { > self->show_preedit = FALSE; > > if (self->preedit_buffer != NULL && self->preedit_buffer->len != 0) > { > g_string_truncate(self->preedit_buffer, 0); > g_signal_emit_by_name(self, > "preedit-changed", > self->preedit_buffer->str); > } > } > } > > > > Cornelius Hald wrote: > > Hi, > > > > I need to know whether or not a word suggestion[1] is currently > > displayed inside a HildonTextView. Even better it would be if I could > > access the content of this suggestion. Is that somehow possible? > > > > Could someone explain how the suggestion is added to the text view? I > > can't find any signals that get fired, but somehow the text is part of > > the text view, I mean, for example, text on the right side of the > > suggestion is correctly moved to the right, text wrapping is working > > etc... > > > > It would be great if someone could explain this black magic to me. What > > I'm trying to do is to apply a certain text style/formatting onto the > > suggestion to make it look consistent with the rest of the text. > > > > Thanks! > > Conny > > > > > > [1] the selected text on the right side of the cursor, that can be > > accepted by pressing the right cursor key. > > > > > > _______________________________________________ > > maemo-developers mailing list > > maemo-developers at maemo.org > > https://lists.maemo.org/mailman/listinfo/maemo-developers > > > > _______________________________________________ > maemo-developers mailing list > maemo-developers at maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers
- Previous message: Word completion in Fremantle
- Next message: Word completion in Fremantle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]