Re: GdkEventKey --> utf-8 ?
- From: Tor Lillqvist <tml iki fi>
- To: Joerg Anders <jan informatik tu-chemnitz de>
- Cc: gtk-list gnome org
- Subject: Re: GdkEventKey --> utf-8 ?
- Date: Thu, 10 Sep 2009 18:25:31 +0300
> ... Why does GtkEntry work correctly?
Because there the inserted text goes through lots of other code than
just directly mapping from key presses to characters, which is never
going to work in general.
You need to read up on GtkIMContext, I think.
> But because the GtkEntry handles this correctly I'm
> convinced there is some function (perhaps hidden) in Gt(d)k
> which has the knowledge of all keyboards layouts in all languages.
Not really knowledge of keyboard layouts. It's a table of compose
sequences, check gtkimcontextsimple.c and gtkimcontextsimpleseqs.h,
and heuristics to handle dead diacritics, see check_algorithmically()
in gtkimcontextsimple.c.
> But actually a text editor user would expect the letters appear
> as soon as he/she presses a key.
Actually, no. When the user presses a dead diacritic key, nothing
should be visible or inserted in an editor buffer. Only after the next
key can the code know what should be inserted.
You don't want a dead diacritic key (like [~]) to cause the
corresponding spacing diacritic (<~>) (sorry for notation I just
invented... in the first case I mean a key, in the second a Unicode
code point) to be inserted, and when the user then types [n] the <~>
then be replaced with <ñ> . Well, a text editor could behave like
that, but it would be different then from how dead diacritics normally
behave.
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]