Replacement for deprecated X11 function (XKeycodeToKeysym).
Various minor changes to get rid of compiler warnings.