On trying to write an simple GUI application I was confronted with difficulties in translation of keysyms into characters, especially with non ASCII chars (I use both Russian and Romanian layout sometimes in one application at once).
The function 'keysym-name' gives me some very nice and correct descriptions that however, I can't draw on the screen i.e. translate into characters, that user input from his keyboard.
For my case, I added a function 'keycode->string' in my CLX module, that uses XLookupString function from libX11. But it's not portable at all.
to be honest, I am hazy on the difference between keysyms and keycodes.
however, there is a function called XLIB:KEYSYM->CHARACTER which, I think, should do what you want.
if what you want is to go from the unicode name, you need CL:NAME-CHAR and XLIB:CHARACTER->KEYSYMS (not implemented, but seems trivial given http://www.x.org/wiki/KeySyms\).
I don't know what your application is, but if you seriously want to accept arbitrary user input, in any language, you might prefer to use such library as pango. If it's just to get an input mechanism for a game, then keysyms are probably OK.
For now, it's a trivial "text entry" that must accept simple text input from the keyboard and draw it using "fixed" font.
And I don't want more functionality that provides the 'libX11' library in my equivalent C code.
I found that the XLIB:DEFAULT-KEYSYM-INDEX functions differ in MIT-CLX and NEW-CLX.
it NEW-CLX it returns constant 0.
Should I write one, for my needs ?
in clx comments it's described that "brain dammaged" :-).
Or maybe it's a reason to use XLookupString() in KEYCODE->CHARACER function in NEW-CLX implimentation ?
All the work is done in the libX11.
there are many snide comments in the code.
not all of them are equally valid.
if you can improve the implementation of any function there, e.g., XLIB:DEFAULT-KEYSYM-INDEX, http://www.cygwin.com/acronyms/#PTC
I don't see how XLookupString is relevant to KEYCODE->CHARACTER, but you can always file a patch (with a few test cases!)
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.