diff src/events/SDL_keyboard.c @ 3132:88861448961f gsoc2009_IME

Add SDL_TEXTEDTING event to inform application about marked text.
author Jiang Jiang <gzjjgod@gmail.com>
date Wed, 01 Jul 2009 07:33:58 +0000
parents 502adab079a4
children
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Wed Jul 01 05:52:17 2009 +0000
+++ b/src/events/SDL_keyboard.c	Wed Jul 01 07:33:58 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)
 {