Hi -
Here's an example:
http://www.gmonline.demon.co.uk/cscene/CS8/xlib-2.c
To receive events (e.g. a "Button Press"), you must first call XSelectInput() with one or more masks (e,g, "ButtonPressMask"), and then check for all events you requested (e.g. with "XNextEvent()").
A "keymapevent" occurs when focus returns to a window (for example). It doesn't mean "a key has been pressed". Rather, it means "you can start pressing keys in this window". Or "you can't press keys anymore", if you've lost focus in that window.
Here's a link that might clarify:
http://tronche.com/gui/x/xlib/events/key-map.html
'Hope that helps .. PSM