comparison src/video/x11/SDL_x11keyboard.c @ 2297:9f712d1e77f2

More typos
author Bob Pendleton <bob@pendleton.com>
date Sat, 12 Jan 2008 16:53:30 +0000
parents 0869721b488f
children 41d2599b7117
comparison
equal deleted inserted replaced
2296:0869721b488f 2297:9f712d1e77f2
49 SDL_cocoakeys.h for more info). Observed to work with Apple X11 on 49 SDL_cocoakeys.h for more info). Observed to work with Apple X11 on
50 Mac OS X 10.4. May also work on older Linux distributions on Mac 50 Mac OS X 10.4. May also work on older Linux distributions on Mac
51 hardware. 51 hardware.
52 */ 52 */
53 53
54 #define KeyCodeTableSize (258) 54 #define KeyCodeTableSize (256)
55 static SDLKey macKeyCodeToSDLK[KeyCodeTableSize] = 55 static SDLKey macKeyCodeToSDLK[KeyCodeTableSize] =
56 { 56 {
57 /* 0 */ SDLK_UNKNOWN, 57 /* 0 */ SDLK_UNKNOWN,
58 /* 1 */ SDLK_UNKNOWN, 58 /* 1 */ SDLK_UNKNOWN,
59 /* 2 */ SDLK_UNKNOWN, 59 /* 2 */ SDLK_UNKNOWN,
902 #if 1 902 #if 1
903 fprintf(stderr, 903 fprintf(stderr,
904 "The key codes of your X server are unknown to SDL. Keys may not be recognized properly. To help get this fixed, report this to the SDL mailing list <sdl@libsdl.org> or to Christian Walther <cwalther@gmx.ch>.\n"); 904 "The key codes of your X server are unknown to SDL. Keys may not be recognized properly. To help get this fixed, report this to the SDL mailing list <sdl@libsdl.org> or to Christian Walther <cwalther@gmx.ch>.\n");
905 #endif 905 #endif
906 data->keyCodeToSDLKTable = 906 data->keyCodeToSDLKTable =
907 SDL_malloc(SDL_arraysize(xorgLinuxKeyCodeToSDLK)); 907 SDL_malloc(KeyCodeTableSize * sizeof(SDLKey));
908 if (data->keyCodeToSDLKTable == NULL) { 908 if (data->keyCodeToSDLKTable == NULL) {
909 SDL_OutOfMemory(); 909 SDL_OutOfMemory();
910 return -1; 910 return -1;
911 } 911 }
912 for (code = SDL_arraysize(xorgLinuxKeyCodeToSDLK); code >= 0; code--) { 912 for (code = KeyCodeTableSize; code >= 0; code--) {
913 data->keyCodeToSDLKTable[code] = 913 data->keyCodeToSDLKTable[code] =
914 X11_KeySymToSDLKey(XKeycodeToKeysym(data->display, code, 0), 914 X11_KeySymToSDLKey(XKeycodeToKeysym(data->display, code, 0),
915 SDL_TRUE); 915 SDL_TRUE);
916 } 916 }
917 } 917 }
918 918
919 /* Set some non-default key names */ 919 /* Set some non-default key names */
920 920
921 for (code = 0; code < SDL_arraysize(xorgLinuxKeyCodeToSDLK); code++) { 921 for (code = 0; code < KeyCodeTableSize; code++) {
922 sdlkey = data->keyCodeToSDLKTable[code]; 922 sdlkey = data->keyCodeToSDLKTable[code];
923 switch (sdlkey) { 923 switch (sdlkey) {
924 /* The SDLK_*META keys are used as XK_Meta_* by some X 924 /* The SDLK_*META keys are used as XK_Meta_* by some X
925 servers, as XK_Super_* by others */ 925 servers, as XK_Super_* by others */
926 case SDLK_LMETA: 926 case SDLK_LMETA:
984 break; /* just to avoid a compiler warning */ 984 break; /* just to avoid a compiler warning */
985 } 985 }
986 986
987 /* Look up physicalKey to get an X11 KeyCode - linear search isn't 987 /* Look up physicalKey to get an X11 KeyCode - linear search isn't
988 terribly efficient, this might have to be optimized. */ 988 terribly efficient, this might have to be optimized. */
989 while ((code < SDL_arraysize(xorgLinuxKeyCodeToSDLK)) && 989 while ((code < KeyCodeTableSize) &&
990 (physicalKey != data->keyCodeToSDLKTable[code])) { 990 (physicalKey != data->keyCodeToSDLKTable[code])) {
991 code++; 991 code++;
992 } 992 }
993 993
994 if (code == SDL_arraysize(xorgLinuxKeyCodeToSDLK)) { 994 if (code == KeyCodeTableSize) {
995 return physicalKey; 995 return physicalKey;
996 } 996 }
997 /* Get the corresponding KeySym - this is where the keyboard 997 /* Get the corresponding KeySym - this is where the keyboard
998 layout comes into play */ 998 layout comes into play */
999 sym = XKeycodeToKeysym(data->display, code, 0); 999 sym = XKeycodeToKeysym(data->display, code, 0);