test/checkkeys.c
changeset 2303 d87417504c75
parent 2300 c97ad1abe05b
child 2305 fbe8ff44c519
equal deleted inserted replaced
2302:7ae1c419b626 2303:d87417504c75
    38         printf(" RCTRL");
    38         printf(" RCTRL");
    39     if (mod & KMOD_LALT)
    39     if (mod & KMOD_LALT)
    40         printf(" LALT");
    40         printf(" LALT");
    41     if (mod & KMOD_RALT)
    41     if (mod & KMOD_RALT)
    42         printf(" RALT");
    42         printf(" RALT");
    43     if (mod & KMOD_LMETA)
    43     if (mod & KMOD_LGUI)
    44         printf(" LMETA");
    44         printf(" LGUI");
    45     if (mod & KMOD_RMETA)
    45     if (mod & KMOD_RGUI)
    46         printf(" RMETA");
    46         printf(" RGUI");
    47     if (mod & KMOD_NUM)
    47     if (mod & KMOD_NUM)
    48         printf(" NUM");
    48         printf(" NUM");
    49     if (mod & KMOD_CAPS)
    49     if (mod & KMOD_CAPS)
    50         printf(" CAPS");
    50         printf(" CAPS");
    51     if (mod & KMOD_MODE)
    51     if (mod & KMOD_MODE)
    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:  physical 0x%08X = %s, layout 0x%08X = %s ",
    60         printf("Key %s:  scancode 0x%04X = %s, keycode 0x%08X = %s ",
    61                pressed ? "pressed " : "released",
    61                pressed ? "pressed " : "released",
    62                sym->sym,
    62                sym->scancode,
    63                SDL_GetKeyName(sym->sym),
    63                SDL_GetScancodeName(sym->scancode),
    64                SDL_GetLayoutKey(sym->sym),
    64                sym->sym, SDL_GetKeyName(sym->sym));
    65                SDL_GetKeyName(SDL_GetLayoutKey(sym->sym)));
       
    66     } else {
    65     } else {
    67         printf("Unknown Key (scancode = 0x%08X) %s ",
    66         printf("Unknown Key (scancode = 0x%04X) %s ",
    68                sym->scancode, pressed ? "pressed" : "released");
    67                sym->scancode, pressed ? "pressed" : "released");
    69     }
    68     }
    70 
    69 
    71     /* Print the translated character, if one exists */
    70     /* Print the translated character, if one exists */
    72     if (sym->unicode) {
    71     if (sym->unicode) {