Fixed compile errors
authorSam Lantinga <slouken@libsdl.org>
Thu, 07 Feb 2008 16:00:29 +0000
changeset 23061a8bab15a45d
parent 2305 fbe8ff44c519
child 2307 47f8a579cd9b
Fixed compile errors
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11keyboard.c
test/common.c
test/testkeys.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Thu Feb 07 15:31:09 2008 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Thu Feb 07 16:00:29 2008 +0000
     1.3 @@ -145,7 +145,7 @@
     1.4  #ifdef DEBUG_XEVENTS
     1.5              printf("MappingNotify!\n");
     1.6  #endif
     1.7 -            X11_UpdateKeymap(this);
     1.8 +            X11_UpdateKeymap(_this);
     1.9          }
    1.10          break;
    1.11  
    1.12 @@ -177,7 +177,7 @@
    1.13      case KeyPress:{
    1.14              KeyCode keycode = xevent.xkey.keycode;
    1.15              KeySym keysym = NoSymbol;
    1.16 -            char text[sizeof(SDL_TEXTINPUTEVENT_TEXT_SIZE)];
    1.17 +            char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
    1.18              Uint32 ucs4 = 0;
    1.19  
    1.20  #ifdef DEBUG_XEVENTS
    1.21 @@ -199,7 +199,7 @@
    1.22  #endif
    1.23              /* Xutf8LookupString(), works for Latin-1 */
    1.24              SDL_zero(text);
    1.25 -            XLookupString(&xevent, text, sizeof(text), &keysym, NULL);
    1.26 +            XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
    1.27              if (*text) {
    1.28                  printf("Sending text event %s\n", text);
    1.29                  SDL_SendKeyboardText(videodata->keyboard, text);
     2.1 --- a/src/video/x11/SDL_x11keyboard.c	Thu Feb 07 15:31:09 2008 +0000
     2.2 +++ b/src/video/x11/SDL_x11keyboard.c	Thu Feb 07 16:00:29 2008 +0000
     2.3 @@ -364,7 +364,7 @@
     2.4  
     2.5      SDL_zero(keyboard);
     2.6      data->keyboard = SDL_AddKeyboard(&keyboard, -1);
     2.7 -    X11_UpdateKeymap(this);
     2.8 +    X11_UpdateKeymap(_this);
     2.9  
    2.10      SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
    2.11  
     3.1 --- a/test/common.c	Thu Feb 07 15:31:09 2008 +0000
     3.2 +++ b/test/common.c	Thu Feb 07 16:00:29 2008 +0000
     3.3 @@ -804,19 +804,19 @@
     3.4          break;
     3.5      case SDL_KEYDOWN:
     3.6          fprintf(stderr,
     3.7 -                "Keyboard %d: key pressed  in window %d: physical 0x%08X = %s, layout 0x%08X = %s",
     3.8 -                event->key.which, event->key.windowID, event->key.keysym.sym,
     3.9 -                SDL_GetKeyName(event->key.keysym.sym),
    3.10 -                SDL_GetLayoutKey(event->key.keysym.sym),
    3.11 -                SDL_GetKeyName(SDL_GetLayoutKey(event->key.keysym.sym)));
    3.12 +                "Keyboard %d: key pressed  in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
    3.13 +                event->key.which, event->key.windowID,
    3.14 +                event->key.keysym.scancode,
    3.15 +                SDL_GetScancodeName(event->key.keysym.scancode),
    3.16 +                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
    3.17          break;
    3.18      case SDL_KEYUP:
    3.19          fprintf(stderr,
    3.20 -                "Keyboard %d: key released in window %d: physical 0x%08X = %s, layout 0x%08X = %s",
    3.21 -                event->key.which, event->key.windowID, event->key.keysym.sym,
    3.22 -                SDL_GetKeyName(event->key.keysym.sym),
    3.23 -                SDL_GetLayoutKey(event->key.keysym.sym),
    3.24 -                SDL_GetKeyName(SDL_GetLayoutKey(event->key.keysym.sym)));
    3.25 +                "Keyboard %d: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
    3.26 +                event->key.which, event->key.windowID,
    3.27 +                event->key.keysym.scancode,
    3.28 +                SDL_GetScancodeName(event->key.keysym.scancode),
    3.29 +                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
    3.30          break;
    3.31      case SDL_TEXTINPUT:
    3.32          fprintf(stderr, "Keyboard %d: text input \"%s\" in window %d",
     4.1 --- a/test/testkeys.c	Thu Feb 07 15:31:09 2008 +0000
     4.2 +++ b/test/testkeys.c	Thu Feb 07 16:00:29 2008 +0000
     4.3 @@ -1,5 +1,5 @@
     4.4  
     4.5 -/* Print out all the keysyms we have, just to verify them */
     4.6 +/* Print out all the scancodes we have, just to verify them */
     4.7  
     4.8  #include <stdio.h>
     4.9  #include <ctype.h>
    4.10 @@ -11,14 +11,15 @@
    4.11  int
    4.12  main(int argc, char *argv[])
    4.13  {
    4.14 -    SDLKey key;
    4.15 +    SDL_scancode scancode;
    4.16  
    4.17      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    4.18          fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    4.19          exit(1);
    4.20      }
    4.21 -    for (key = SDLK_FIRST; key < SDLK_LAST; ++key) {
    4.22 -        printf("Key #%d, \"%s\"\n", key, SDL_GetKeyName(key));
    4.23 +    for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
    4.24 +        printf("Scancode #%d, \"%s\"\n", scancode,
    4.25 +               SDL_GetScancodeName(scancode));
    4.26      }
    4.27      SDL_Quit();
    4.28      return (0);