comparison src/events/SDL_keyboard.c @ 4529:05ab4141ce93

Fixed bug 1014 Don't send events for unprintable characters
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Jul 2010 18:57:51 -0700
parents 06c7423f8c60
children 95352c671a6e 436183eb30c8
comparison
equal deleted inserted replaced
4528:f06faa886423 4529:05ab4141ce93
762 SDL_SendKeyboardText(const char *text) 762 SDL_SendKeyboardText(const char *text)
763 { 763 {
764 SDL_Keyboard *keyboard = &SDL_keyboard; 764 SDL_Keyboard *keyboard = &SDL_keyboard;
765 int posted; 765 int posted;
766 766
767 /* Don't post text events for unprintable characters */
768 if (*text < ' ') {
769 return 0;
770 }
771
767 /* Post the event, if desired */ 772 /* Post the event, if desired */
768 posted = 0; 773 posted = 0;
769 if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { 774 if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
770 SDL_Event event; 775 SDL_Event event;
771 event.text.type = SDL_TEXTINPUT; 776 event.text.type = SDL_TEXTINPUT;