Mercurial > sdl-ios-xcode
diff src/events/SDL_keyboard.c @ 4435:e953700da4ca
Minor cleanup on Jiang's patch
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 15 Apr 2010 22:27:01 -0700 |
parents | 5c64052fb476 |
children | 25e45611fa3d |
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c Thu Apr 15 22:14:26 2010 -0700 +++ b/src/events/SDL_keyboard.c Thu Apr 15 22:27:01 2010 -0700 @@ -679,8 +679,10 @@ if (keyboard->focus) { SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) + + if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { SDL_StartTextInput(); + } } } @@ -832,6 +834,7 @@ if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_Event event; event.text.type = SDL_TEXTINPUT; + event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; event.text.which = (Uint8) index; SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); event.text.windowID = keyboard->focus->id; @@ -846,18 +849,20 @@ SDL_Keyboard *keyboard = SDL_GetKeyboard(index); int posted; - if (!keyboard) + if (!keyboard) { return 0; + } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) { SDL_Event event; event.edit.type = SDL_TEXTEDITING; + event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; + event.text.which = (Uint8) index; event.edit.start = start; event.edit.length = length; - SDL_strlcpy(event.edit.text, text, SDL_arraysize(event.text.text)); - event.edit.windowID = keyboard->focus->id; + SDL_strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); posted = (SDL_PushEvent(&event) > 0); } return (posted);