[Xcb] looking up the right keysym and retrieving printable chars

Julien Danjou julien at danjou.info
Sat Feb 6 13:39:17 PST 2010

At 1265474057 time_t, Moritz Bruder wrote:
> how do you retrieve the correct keysymbols and get a string if the
> keysymbol is printable?

You can't.
Most of that stuff are not part of the X protocol, and are hard coded into Xlib.
And many are probably tight with XKB extension.

> i already had a look at awesome source and looking up the right keysym
> seems very easy, but i would like to know why it is this way.
> (especially what the colum parameter in xcb_key_symbols_get_keysym is
> for)

It's a bit tricky to understand but reading awesome source code and
explanation in xcb-util sources might help.

Basically, I'd explain it this way:
You have a key with a keycode '24'. This keycode has several keysyms:
'q' and 'Q'
You have to chose if you are going to resolve this 24 to q or Q. To do
that, you examine the modifiers state, and if Shift is pressed, you will
chose Q. Same if Caps Lock is on.

q and Q are stored into 'columns', the parameter you were wondering
about. Actually, each keycode has 6 column (0 to 5), and when a keycode
is pressed, picking up the right column is a complicated process of
looking what is the state of all modifiers. This has been coded and
implemented by Arnaud in awesome as you might see.

Keep in mind that awesome key and xcb-util key code works quite well but
he's not as complete as Xlib and XKB might offers nowadays.


Julien Danjou
// ᐰ <julien at danjou.info>   http://julien.danjou.info
// Tomorrow I was nothing, yesterday I'll be.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20100206/b41bf44e/attachment.pgp 

More information about the Xcb mailing list