Russell Shaw wrote: > For functions XkbLookupKeySym(), XLookupString(), XKeycodeToKeysym(), > XKeysymToString etc, how can i tell if the keysym is a graphic printable > character like "a", or a control character such as "Left" (XK_Left) ? > > I need to tell automatically if it's a normal unicode character that can be > printed in an entry box for any written language.
For languages other than English, keyboard input isn't as simple as one keypress => one character. Many Western languages use "dead" accents (i.e. pressing an accent key causes the next character to be accented) or compose processing (e.g. Compose,o,/ => ΓΈ), and East-Asian languages typically require far more complex input methods. > Do these functions return UTF-8 unicode? XLookupString() uses ISO-8859-1. XmbLookupString() and XwcLookupString() return strings in a locale-specific encoding. If X_HAVE_UTF8_STRING is defined, Xutf8LookupString() returns a UTF-8 string. All three functions require an input context (see XOpenIM() and XCreateIC() for a starting point, but you probably aren't going to work it out from manual pages alone). Unless you're planning on spending the next few months learning how text entry works for languages other than English, I'd recommend using a GUI toolkit rather than trying to do it using bare Xlib. Or at least steal the code from such a toolkit. -- Glynn Clements <[email protected]> _______________________________________________ xorg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xorg
