changeset 2306:1a8bab15a45d

Fixed compile errors
author Sam Lantinga <slouken@libsdl.org>
date Thu, 07 Feb 2008 16:00:29 +0000
parents fbe8ff44c519
children 47f8a579cd9b
files src/video/x11/SDL_x11events.c src/video/x11/SDL_x11keyboard.c test/common.c test/testkeys.c
diffstat 4 files changed, 19 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Thu Feb 07 15:31:09 2008 +0000
+++ b/src/video/x11/SDL_x11events.c	Thu Feb 07 16:00:29 2008 +0000
@@ -145,7 +145,7 @@
 #ifdef DEBUG_XEVENTS
             printf("MappingNotify!\n");
 #endif
-            X11_UpdateKeymap(this);
+            X11_UpdateKeymap(_this);
         }
         break;
 
@@ -177,7 +177,7 @@
     case KeyPress:{
             KeyCode keycode = xevent.xkey.keycode;
             KeySym keysym = NoSymbol;
-            char text[sizeof(SDL_TEXTINPUTEVENT_TEXT_SIZE)];
+            char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
             Uint32 ucs4 = 0;
 
 #ifdef DEBUG_XEVENTS
@@ -199,7 +199,7 @@
 #endif
             /* Xutf8LookupString(), works for Latin-1 */
             SDL_zero(text);
-            XLookupString(&xevent, text, sizeof(text), &keysym, NULL);
+            XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
             if (*text) {
                 printf("Sending text event %s\n", text);
                 SDL_SendKeyboardText(videodata->keyboard, text);
--- a/src/video/x11/SDL_x11keyboard.c	Thu Feb 07 15:31:09 2008 +0000
+++ b/src/video/x11/SDL_x11keyboard.c	Thu Feb 07 16:00:29 2008 +0000
@@ -364,7 +364,7 @@
 
     SDL_zero(keyboard);
     data->keyboard = SDL_AddKeyboard(&keyboard, -1);
-    X11_UpdateKeymap(this);
+    X11_UpdateKeymap(_this);
 
     SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
 
--- a/test/common.c	Thu Feb 07 15:31:09 2008 +0000
+++ b/test/common.c	Thu Feb 07 16:00:29 2008 +0000
@@ -804,19 +804,19 @@
         break;
     case SDL_KEYDOWN:
         fprintf(stderr,
-                "Keyboard %d: key pressed  in window %d: physical 0x%08X = %s, layout 0x%08X = %s",
-                event->key.which, event->key.windowID, event->key.keysym.sym,
-                SDL_GetKeyName(event->key.keysym.sym),
-                SDL_GetLayoutKey(event->key.keysym.sym),
-                SDL_GetKeyName(SDL_GetLayoutKey(event->key.keysym.sym)));
+                "Keyboard %d: key pressed  in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
+                event->key.which, event->key.windowID,
+                event->key.keysym.scancode,
+                SDL_GetScancodeName(event->key.keysym.scancode),
+                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
         break;
     case SDL_KEYUP:
         fprintf(stderr,
-                "Keyboard %d: key released in window %d: physical 0x%08X = %s, layout 0x%08X = %s",
-                event->key.which, event->key.windowID, event->key.keysym.sym,
-                SDL_GetKeyName(event->key.keysym.sym),
-                SDL_GetLayoutKey(event->key.keysym.sym),
-                SDL_GetKeyName(SDL_GetLayoutKey(event->key.keysym.sym)));
+                "Keyboard %d: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
+                event->key.which, event->key.windowID,
+                event->key.keysym.scancode,
+                SDL_GetScancodeName(event->key.keysym.scancode),
+                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
         break;
     case SDL_TEXTINPUT:
         fprintf(stderr, "Keyboard %d: text input \"%s\" in window %d",
--- a/test/testkeys.c	Thu Feb 07 15:31:09 2008 +0000
+++ b/test/testkeys.c	Thu Feb 07 16:00:29 2008 +0000
@@ -1,5 +1,5 @@
 
-/* Print out all the keysyms we have, just to verify them */
+/* Print out all the scancodes we have, just to verify them */
 
 #include <stdio.h>
 #include <ctype.h>
@@ -11,14 +11,15 @@
 int
 main(int argc, char *argv[])
 {
-    SDLKey key;
+    SDL_scancode scancode;
 
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
         fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
         exit(1);
     }
-    for (key = SDLK_FIRST; key < SDLK_LAST; ++key) {
-        printf("Key #%d, \"%s\"\n", key, SDL_GetKeyName(key));
+    for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
+        printf("Scancode #%d, \"%s\"\n", scancode,
+               SDL_GetScancodeName(scancode));
     }
     SDL_Quit();
     return (0);