Mercurial > sdl-ios-xcode
comparison src/events/SDL_keyboard.c @ 4754:2072fed2f583
Added SDL_utf8strlcpy to copy at UTF-8 character boundaries.
Changed SDL_SendKeyboardText and SDL_SendEditingText to use SDL_utf8strlcpy.
author | dewyatt |
---|---|
date | Tue, 13 Jul 2010 15:05:45 -0400 |
parents | 11b0a6a3eb4d |
children | 436183eb30c8 |
comparison
equal
deleted
inserted
replaced
4753:11b0a6a3eb4d | 4754:2072fed2f583 |
---|---|
764 posted = 0; | 764 posted = 0; |
765 if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { | 765 if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { |
766 SDL_Event event; | 766 SDL_Event event; |
767 event.text.type = SDL_TEXTINPUT; | 767 event.text.type = SDL_TEXTINPUT; |
768 event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; | 768 event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; |
769 SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); | 769 SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); |
770 event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; | 770 event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; |
771 posted = (SDL_PushEvent(&event) > 0); | 771 posted = (SDL_PushEvent(&event) > 0); |
772 } | 772 } |
773 return (posted); | 773 return (posted); |
774 } | 774 } |
785 SDL_Event event; | 785 SDL_Event event; |
786 event.edit.type = SDL_TEXTEDITING; | 786 event.edit.type = SDL_TEXTEDITING; |
787 event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; | 787 event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; |
788 event.edit.start = start; | 788 event.edit.start = start; |
789 event.edit.length = length; | 789 event.edit.length = length; |
790 SDL_strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); | 790 SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); |
791 posted = (SDL_PushEvent(&event) > 0); | 791 posted = (SDL_PushEvent(&event) > 0); |
792 } | 792 } |
793 return (posted); | 793 return (posted); |
794 } | 794 } |
795 | 795 |