mirror of https://github.com/encounter/SDL.git
[ibus] Send an empty TextEditing event when the text is cleared by pressing backspace.
This commit is contained in:
parent
21d0cdedb3
commit
42d9cf6978
|
@ -156,12 +156,12 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data)
|
||||||
dbus->message_iter_init(msg, &iter);
|
dbus->message_iter_init(msg, &iter);
|
||||||
text = IBus_GetVariantText(conn, &iter, dbus);
|
text = IBus_GetVariantText(conn, &iter, dbus);
|
||||||
|
|
||||||
if (text && *text) {
|
if (text) {
|
||||||
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
||||||
size_t text_bytes = SDL_strlen(text), i = 0;
|
size_t text_bytes = SDL_strlen(text), i = 0;
|
||||||
size_t cursor = 0;
|
size_t cursor = 0;
|
||||||
|
|
||||||
while (i < text_bytes) {
|
do {
|
||||||
size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
|
size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
|
||||||
size_t chars = IBus_utf8_strlen(buf);
|
size_t chars = IBus_utf8_strlen(buf);
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data)
|
||||||
|
|
||||||
i += sz;
|
i += sz;
|
||||||
cursor += chars;
|
cursor += chars;
|
||||||
}
|
} while (i < text_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_IBus_UpdateTextRect(NULL);
|
SDL_IBus_UpdateTextRect(NULL);
|
||||||
|
|
Loading…
Reference in New Issue