[Xcb] XCB keyboard input
Chuck Pergiel
c.pergiel at gmail.com
Wed Mar 8 14:34:30 UTC 2017
I've been working through the tutorial
<https://xcb.freedesktop.org/tutorial/> and everything was going swimmingly
until I got to the bit about keyboard input
<https://xcb.freedesktop.org/tutorial/fonts/>. Pressing the ESC key sends a
value of 9 to the program, which is great, but how did the ESC key get
translated to 9? The section of the program dealing with keyboard input is
listed below.
I can enter characters at the keyboard, but the values that show up in the
program are not the normal ASCII values. I've dug around a bit but I
haven't found much of anything that was very helpful.
If you can offer any advice, I would appreciate hearing from you.
Chuck Pergiel
Silicon Forest
www.pergelator.blogspot.com
Sent from my Commodore-64 via a US Robotics 300 Baud Modem
P.S. I'm running Linux Mint on an HP desktop PC, if that makes any
difference.
/* event loop */
xcb_generic_event_t *event;
while (1) { ;
if ( (event = xcb_poll_for_event(connection)) ) {
switch (event->response_type & ~0x80) {
case XCB_EXPOSE: {
drawText (connection,
screen,
window,
10, HEIGHT - 10,
"Press ESC key to exit..." );
break;
}
case XCB_KEY_RELEASE: {
xcb_key_release_event_t *kr =
(xcb_key_release_event_t *)event;
switch (kr->detail) {
/* ESC */
case 9: {
free (event);
xcb_disconnect (connection);
return 0;
}
}
free (event);
}
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20170308/6c495147/attachment.html>
More information about the Xcb
mailing list