comparison test/checkkeys.c @ 2295:dbc6d1893869

Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
author Bob Pendleton <bob@pendleton.com>
date Tue, 08 Jan 2008 00:10:46 +0000
parents c121d94672cb
children c97ad1abe05b
comparison
equal deleted inserted replaced
2294:386ebf50dd91 2295:dbc6d1893869
55 static void 55 static void
56 PrintKey(SDL_keysym * sym, int pressed) 56 PrintKey(SDL_keysym * sym, int pressed)
57 { 57 {
58 /* Print the keycode, name and state */ 58 /* Print the keycode, name and state */
59 if (sym->sym) { 59 if (sym->sym) {
60 printf("Key %s: %d-%s ", pressed ? "pressed" : "released", 60 printf("Key %s: physical 0x%08X = %s, layout 0x%08X = %s ",
61 sym->sym, SDL_GetKeyName(sym->sym)); 61 pressed ? "pressed " : "released",
62 sym->sym,
63 SDL_GetKeyName(sym->sym),
64 SDL_GetLayoutKey(sym->sym),
65 SDL_GetKeyName(SDL_GetLayoutKey(sym->sym)));
62 } else { 66 } else {
63 printf("Unknown Key (scancode = %d) %s ", sym->scancode, 67 printf("Unknown Key (scancode = 0x%08X) %s ",
64 pressed ? "pressed" : "released"); 68 sym->scancode, pressed ? "pressed" : "released");
65 } 69 }
66 70
67 /* Print the translated character, if one exists */ 71 /* Print the translated character, if one exists */
68 if (sym->unicode) { 72 if (sym->unicode) {
69 /* Is it a control-character? */ 73 /* Is it a control-character? */