This is a bug in XFree86 3.3.6. The following code shows that XtTranslateKeycode is not taking account of the CapsLock key. main(int argc, char *argv[]) { char *fallback[] = { (char *)NULL }; Widget toplevel; Display *Display; XtAppContext app_con; XrmOptionDescRec Options[] = {}; KeySym sym0, sym1, sym2, sym3; Modifiers mod0, mod1, mod2, mod3; KeyCode KeyA; int i, NumCodes; KeyCode *KeyCode; toplevel = XtAppInitialize(&app_con, "Test", Options, XtNumber(Options), &argc, argv, fallback, NULL, 0); if(toplevel == NULL) { fprintf(stderr, "Failed to initialize\n"); } Display = XtDisplay(toplevel); if(Display == NULL) { fprintf(stderr, "Failed to set display\n"); } XtKeysymToKeycodeList(Display, (KeySym)0x41, &KeyCode, &NumCodes); for(i=0; i<NumCodes; i++) { printf("Keycode for 'A' is 0x%x\n", KeyCode[i]); } KeyA = KeyCode[0]; XtTranslateKeycode(Display, KeyA, (Modifiers)0, &mod0, &sym0); XtTranslateKeycode(Display, KeyA, ShiftMask, &mod1, &sym1); XtTranslateKeycode(Display, KeyA, LockMask, &mod2, &sym2); XtTranslateKeycode(Display, KeyA, ShiftMask | LockMask, &mod3, &sym3); printf("Keysyms for 'A' are:\n" "\tShift:\t\t%x modifiers returned=%d\n" "\tLock:\t\t%x modifiers returned=%d\n" "\tShift+Lock:\t%x modifiers returned=%d\n", sym0, mod0, sym1, mod1, sym2, mod2, sym3, mod3); } ---------------------------------------------------------- Output is: Keycode for 'A' is 0x26 Keysyms for 'A' are: Unmodified: 61 modifiers returned=1 Shift: 41 modifiers returned=1 Lock: 61 modifiers returned=1 Shift+Lock: 41 modifiers returned=1 --- Note that the Lock key has no effect on the KeySym. "\tUnmodified:\t%x modifiers returned=%d\n"
CapsLock doesn't modify the keysym, it changes the modifier bits (i.e. 0x2 for CapsLock).