test/testime.c
changeset 4465 3e69e077cb95
parent 3581 15eea7a1fa97
child 4637 8c229370ddba
child 4756 b99b1024607a
equal deleted inserted replaced
4464:fa77a6429698 4465:3e69e077cb95
   277             {
   277             {
   278                 break;
   278                 break;
   279             }
   279             }
   280 
   280 
   281             fprintf(stderr,
   281             fprintf(stderr,
   282                     "Keyboard %d: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
   282                     "Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
   283                     event.key.which, event.key.keysym.scancode,
   283                     event.key.keysym.scancode,
   284                     SDL_GetScancodeName(event.key.keysym.scancode),
   284                     SDL_GetScancodeName(event.key.keysym.scancode),
   285                     event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
   285                     event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
   286             break;
   286             break;
   287 
   287 
   288         case SDL_TEXTINPUT:
   288         case SDL_TEXTINPUT:
   289             if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
   289             if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
   290                 markedRect.w < 0)
   290                 markedRect.w < 0)
   291                 break;
   291                 break;
   292 
   292 
   293             fprintf(stderr, "Keyboard %d: text input \"%s\"\n",
   293             fprintf(stderr, "Keyboard: text input \"%s\"\n", event.text.text);
   294                     event.text.which, event.text.text);
       
   295 
   294 
   296             if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
   295             if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
   297                 strcpy(text + SDL_strlen(text), event.text.text);
   296                 strcpy(text + SDL_strlen(text), event.text.text);
   298 
   297 
   299             fprintf(stderr, "text inputed: %s\n", text);
   298             fprintf(stderr, "text inputed: %s\n", text);