To learn how things work in Xlib and XI2 programming, I’ve written a little game. You can attach multiple keyboards to one computer and then invite some friends over to see, who can type fastest. The code is really smelly because I did this only for learning purpose. If you like it, feel free to make the code and/or the game better (like bigger font size or more player support or something).
You can get the code on github.
UPDATE: The code is ported to Qt (better font rendering, fullscreen…) and can be found here: https://www.ralfj.de/git/multypo.git. Qt does not support distinguishing key presses between different keyboards, so the event handling code is still X specific.