mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-02 18:14:35 +00:00
Dynamically allocate long text for SDL_EVENT_TEXT_INPUT events
This prevents input text from being split across Unicode combining or modifier characters, and in practice allocations will rarely happen.
This commit is contained in:
@@ -186,6 +186,7 @@ static void loop(void)
|
||||
case SDL_EVENT_TEXT_INPUT:
|
||||
PrintText("INPUT", event.text.text);
|
||||
SDLTest_TextWindowAddText(textwin, "%s", event.text.text);
|
||||
SDL_CleanupEvent(&event);
|
||||
break;
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
if (SDL_TextInputActive()) {
|
||||
|
||||
@@ -187,6 +187,7 @@ static void loop(void)
|
||||
break;
|
||||
case SDL_EVENT_TEXT_INPUT:
|
||||
PrintText("INPUT", event.text.text);
|
||||
SDL_CleanupEvent(&event);
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
/* Left button quits the app, other buttons toggles text input */
|
||||
|
||||
@@ -1728,6 +1728,7 @@ static void loop(void *arg)
|
||||
AddControllerNameText(event.text.text);
|
||||
}
|
||||
}
|
||||
SDL_CleanupEvent(&event);
|
||||
break;
|
||||
case SDL_EVENT_QUIT:
|
||||
done = SDL_TRUE;
|
||||
|
||||
@@ -770,6 +770,7 @@ int main(int argc, char *argv[])
|
||||
/* is committed */
|
||||
markedText[0] = 0;
|
||||
Redraw();
|
||||
SDL_CleanupEvent(&event);
|
||||
break;
|
||||
|
||||
case SDL_EVENT_TEXT_EDITING:
|
||||
|
||||
Reference in New Issue
Block a user