src/events/SDL_keyboard.c
changeset 2300 c97ad1abe05b
parent 2295 dbc6d1893869
child 2303 d87417504c75
     1.1 --- a/src/events/SDL_keyboard.c	Sat Jan 12 18:07:06 2008 +0000
     1.2 +++ b/src/events/SDL_keyboard.c	Tue Jan 15 22:37:17 2008 +0000
     1.3 @@ -37,8 +37,8 @@
     1.4  static SDL_Keyboard **SDL_keyboards;
     1.5  
     1.6  /* Taken from SDL_iconv() */
     1.7 -static char *
     1.8 -encodeUtf8(Uint32 ch, char *dst)
     1.9 +char *
    1.10 +SDL_Ucs4ToUtf8(Uint32 ch, char *dst)
    1.11  {
    1.12      Uint8 *p = (Uint8 *) dst;
    1.13      if (ch <= 0x7F) {
    1.14 @@ -266,17 +266,21 @@
    1.15              keyname = _this->GetSpecialKeyName(_this, layoutKey);
    1.16          }
    1.17      } else if ((layoutKey & SDL_KEY_CAN_BE_PHYSICAL_BIT) == 0) {
    1.18 -        /* SDLK_INDEX(layoutKey) is the unicode code point of the character generated by the key */
    1.19 +        /* SDLK_INDEX(layoutKey) is the unicode code point of the
    1.20 +           character generated by the key */
    1.21          static char buffer[9];  /* 6 (maximal UTF-8 char length) + 2 ([] for keypad) + 1 (null teminator) */
    1.22          char *bufferPtr = &buffer[1];
    1.23          Uint32 codepoint = SDLK_INDEX(layoutKey);
    1.24  
    1.25 -        /* Unaccented letter keys on latin keyboards are normally labeled in upper case (and probably on others like Greek or Cyrillic too, so if you happen to know for sure, please adapt this). */
    1.26 +        /* Unaccented letter keys on latin keyboards are normally
    1.27 +           labeled in upper case (and probably on others like Greek or
    1.28 +           Cyrillic too, so if you happen to know for sure, please
    1.29 +           adapt this). */
    1.30          if (codepoint >= 'a' && codepoint <= 'z') {
    1.31              codepoint -= 32;
    1.32          }
    1.33  
    1.34 -        bufferPtr = encodeUtf8(codepoint, bufferPtr);
    1.35 +        bufferPtr = SDL_Ucs4ToUtf8(codepoint, bufferPtr);
    1.36          *bufferPtr = '\0';
    1.37  
    1.38          if ((layoutKey & SDL_KEY_KEYPAD_BIT) != 0) {