throw new Error("Can't open X Display");
}
try {
byte[] keys = new byte[32];
// Ignore the return value
lib.XQueryKeymap(dpy, keys);
int keysym = toKeySym(keycode, location);
for (int code=5;code < 256;code++) {
int idx = code / 8;
int shift = code % 8;
if ((keys[idx] & (1 << shift)) != 0) {