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:
Sam Lantinga
2023-11-04 16:53:25 -07:00
parent 2a1660ab51
commit 75ea3a8d32
8 changed files with 25 additions and 12 deletions

View File

@@ -284,7 +284,8 @@ typedef struct SDL_TextInputEvent
Uint32 type; /**< ::SDL_EVENT_TEXT_INPUT */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
char *text; /**< The input text */
char short_text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< Memory space for short input text, use 'text' instead */
} SDL_TextInputEvent;
/**