mirror of
https://github.com/encounter/SDL.git
synced 2025-12-14 23:56:19 +00:00
IME Composition Truncation + SDL_IsTextInputShown + SDL_ClearComposition (#5398)
* Fixes for IME Composition Truncation + Addition of SDL_ClearComposition, SDL_IsTextInputShown * Fixed: Documentation and code style issues raised during code review.
This commit is contained in:
@@ -894,6 +894,22 @@ SDL_SendEditingText(const char *text, int start, int length)
|
||||
event.edit.start = start;
|
||||
event.edit.length = length;
|
||||
SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
|
||||
|
||||
if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) &&
|
||||
SDL_strlen(text) > SDL_arraysize(event.text.text)) {
|
||||
event.editExt.type = SDL_TEXTEDITING_EXT;
|
||||
event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||
event.editExt.text = text ? SDL_strdup(text) : NULL;
|
||||
event.editExt.start = start;
|
||||
event.editExt.length = length;
|
||||
} else {
|
||||
event.edit.type = SDL_TEXTEDITING;
|
||||
event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||
event.edit.start = start;
|
||||
event.edit.length = length;
|
||||
SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
|
||||
}
|
||||
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
return (posted);
|
||||
|
||||
Reference in New Issue
Block a user