diff src/events/SDL_keyboard.c @ 3280:00cace2d9080

Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
author Sam Lantinga <slouken@libsdl.org>
date Sat, 19 Sep 2009 13:29:40 +0000
parents dc1eb82ffdaa
children 98a819296cdc
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Sat Sep 19 12:48:52 2009 +0000
+++ b/src/events/SDL_keyboard.c	Sat Sep 19 13:29:40 2009 +0000
@@ -852,6 +852,24 @@
     return (posted);
 }
 
+int
+SDL_SendEditingText(const char *text, int start, int length)
+{
+    int posted;
+
+    /* Post the event, if desired */
+    posted = 0;
+    if (SDL_ProcessEvents[SDL_TEXTEDITING] == SDL_ENABLE) {
+        SDL_Event event;
+        event.edit.type = SDL_TEXTEDITING;
+        event.edit.start = start;
+        event.edit.length = length;
+        SDL_strlcpy(event.edit.text, text, SDL_arraysize(event.text.text));
+        posted = (SDL_PushEvent(&event) > 0);
+    }
+    return (posted);
+}
+
 void
 SDL_KeyboardQuit(void)
 {