X11 KeySym to Unicode mapping: need for XLookupKeySym()?

Shaheed srhaque at iee.org
Thu Oct 30 10:10:55 GMT 2003


Hi all,

In working on some keyboard-related stuff recently, I came across the question 
of how to convert an X11 KeySym to the corresponding Unicode code.

It seems that lots of people have to solve this problem:

- xterm has http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c

- gdk has http://cvs.sourceforge.net/viewcvs.py/zemljanka/cursed/gtk+/gdk/
gdkkeyuni.c (derived from keysym2ucs.c)

- Qt has keysymToUnicode() and its caller in http://webcvs.kde.org/cgi-bin/
cvsweb.cgi/qt-copy/src/kernel/qapplication_x11.cpp (big overlap with 
keysym2ucs.c)

- X11 has http://cvsweb.xfree86.org/cvsweb/xc/lib/X11/imKStoUCS.c (I *think* 
this is also relevant, but must confess to beign a bit unsure here).

Is there an existing X public API that does this mapping? If not, I would like 
to suggest one is added. Something like:

	unsigned int XLookupKeySym(KeySym keysym);

assuming 4 byte ints.

Thanks, Shaheed

P.S. Please CC me on replies as I'm not subscribed here.




More information about the kde-core-devel mailing list