diff test/testime.c @ 3136:962357f325e1 gsoc2009_IME

Further polish API, fix crash in test program.
author Jiang Jiang <gzjjgod@gmail.com>
date Thu, 06 Aug 2009 08:59:53 +0000
parents f896821736fb
children 311c678f3b2e
line wrap: on
line diff
--- a/test/testime.c	Thu Aug 06 08:56:48 2009 +0000
+++ b/test/testime.c	Thu Aug 06 08:59:53 2009 +0000
@@ -65,6 +65,7 @@
 
 void CleanupVideo()
 {
+    SDL_StopTextInput();
     TTF_CloseFont(font);
     TTF_Quit();
 }
@@ -82,6 +83,8 @@
     text[0] = 0;
     markedRect = textRect;
     markedText = NULL;
+
+    SDL_StartTextInput();
 }
 
 static void RenderText(SDL_Surface *sur,
@@ -115,6 +118,8 @@
     if (markedRect.w < 0)
     {
         SDL_Flip(screen);
+        // Stop text input because we cannot hold any more characters
+        SDL_StopTextInput();
         return;
     }
 
@@ -139,7 +144,7 @@
 
     SDL_Flip(screen);
 
-    SDL_StartTextInput(&markedRect);
+    SDL_SetTextInputRect(&markedRect);
 }
 
 void