From bfffa275ef59dd22f50e78a5cbcd892b85142258 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 14 Dec 2020 09:23:53 -0800 Subject: [PATCH] Fixed bug 5397 - Fcitx input is truncated sowfelicity Split the long text input event into multiple shorten text input event. --- src/core/linux/SDL_fcitx.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c index c0005b563..1d726651b 100644 --- a/src/core/linux/SDL_fcitx.c +++ b/src/core/linux/SDL_fcitx.c @@ -144,8 +144,17 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) dbus->message_iter_init(msg, &iter); dbus->message_iter_get_basic(&iter, &text); - if (text) - SDL_SendKeyboardText(text); + if (text && *text) { + char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; + size_t text_bytes = SDL_strlen(text), i = 0; + + while (i < text_bytes) { + size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + SDL_SendKeyboardText(buf); + + i += sz; + } + } return DBUS_HANDLER_RESULT_HANDLED; }