Re: Problems in Typing Vietnamese in Gtk application
- From: Gaurav Jain <gaurav anywhere gmail com>
- To: Botond Botyanszki <gtk-i18n siliconium net>
- Cc: gtk-app-devel-list gnome org, gtk-i18n-list gnome org
- Subject: Re: Problems in Typing Vietnamese in Gtk application
- Date: Thu, 13 Oct 2005 17:43:31 +0530
Hello Botond,
Thanks for your inputs. Unfortunately I cannot use a new widget
because of architectural constraints (I'm working on an existing
code-base that's based on GtkLayout as the base widget), and so must
use a GtkLayout to process the inputs (i.e., the actual receiver of
the Vietnamese Inputs must be a GtkLayout widget). I understand that
if I use a new widget, I may be able to work the way a GtkEntry is
working in handling this.
I looked into the GtkEntry source code, and discovered that the way it
works is that it "commits" new text coming in the "commit_cb" from the
IM at the end of the current cursor. The key part is that for every
sequence of "dependent" characters that are typed, such as "e" which
means 'e', and "ee" which means 'ê', and an extra, non dependent
character has also been typed such as "eeg" which means "êg", then the
GtkEntry's "delete_from_cursor" event is fired automatically (actually
as a result of the call to (GTK_WIDGET_CLASS
(parent_class)->key_press_event (widget, event))) from the
"key_press_event" for the GtkEntry. So what it does is that the
existing characters are deleted from the entry, and the new ones are
entered. This event is not triggered in case we type subsequent
non-dependent characters, so that the newly commited characters are
appended to the existing text in the entry, as expected.
I was wondering how to "catch" the "delete_from_cursor" event in a
GtkLayout, which inherently doesn't have a "cursor" associated with
it. Is this an impossible task? Is there a workaround to get to
receive similar events which can tell us that some existing text needs
to be deleted?
Alternatively, if it were possible to "simulate" the typing of text on
a "hidden" GtkEntry, and then retrieve the text from that, that would
also work for me. Is there a way to do that?
Please help out if you have any comments on any of these points. It
would be highly appreciated.
Copying to the gtk-app-devel-list, as some of my queries concern Gtk
widgets and their working.
Thanks once again,
Gaurav
On 10/10/05, Botond Botyanszki <gtk-i18n siliconium net> wrote:
>
> On Mon, 10 Oct 2005 15:09:36 +0530
> Gaurav Jain <gaurav anywhere gmail com> wrote:
>
> > Are you talking about the gtk_im_context_get_preedit_string() API? If
> > so, that won't work for me, because in my case this is not returning
> > the complete string, but is always empty. Note that the
> > "preedit_changed_cb" is never being called in case of Vietnamese -
> > what's happening is that the "commit_cb" is getting called at each
> > key-press. And a call to gtk_im_context_get_preedit_string() from the
> > commit_cb() returns empty string.
>
> Transforming the input should be done in the IM, not in your widget.
> I would adwise against doing such ugly hacks.
> The gtkentry source (and others) has working code with the vietnamese
> IM, why don't you look at that and implement your own widget
> like it's done there?
>
> _______________________________________________
> gtk-i18n-list mailing list
> gtk-i18n-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]