You need key sims, not key codes. See XKeycodeToKeysym () and / usr / include / X 11 / keysymdef.h
To be strictly correct (especially with internationalization), you need a whole bunch of code according to http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkkeys-x11.c
However, if you use raw Xlib instead of a set of tools, you probably don’t care if you have been working for many years, and XKeycodeToKeysym () is good enough for American keyboards.
source
share