diff --git a/desktop_version/src/KeyPoll.cpp b/desktop_version/src/KeyPoll.cpp index b56b9d47..55779915 100644 --- a/desktop_version/src/KeyPoll.cpp +++ b/desktop_version/src/KeyPoll.cpp @@ -50,7 +50,8 @@ KeyPoll::KeyPoll(void) // 0..5 sensitivity = 2; - keybuffer=""; + keybuffer = ""; + imebuffer = ""; leftbutton=0; rightbutton=0; middlebutton=0; mousex = 0; mousey = 0; @@ -64,13 +65,15 @@ KeyPoll::KeyPoll(void) void KeyPoll::enabletextentry(void) { - keybuffer=""; + keybuffer = ""; + imebuffer = ""; SDL_StartTextInput(); } void KeyPoll::disabletextentry(void) { SDL_StopTextInput(); + imebuffer = ""; } bool KeyPoll::textentry(void) @@ -321,6 +324,13 @@ void KeyPoll::Poll(void) keybuffer += evt.text.text; } break; + case SDL_TEXTEDITING: + imebuffer = evt.edit.text; + break; + case SDL_TEXTEDITING_EXT: + imebuffer = evt.editExt.text; + SDL_free(evt.editExt.text); + break; /* Mouse Input */ case SDL_MOUSEMOTION: diff --git a/desktop_version/src/KeyPoll.h b/desktop_version/src/KeyPoll.h index 5718ebf0..2d7c5f9b 100644 --- a/desktop_version/src/KeyPoll.h +++ b/desktop_version/src/KeyPoll.h @@ -69,6 +69,7 @@ public: bool textentry(void); bool pressedbackspace; std::string keybuffer; + std::string imebuffer; bool linealreadyemptykludge; diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index c3672eb4..2f884ec7 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -599,6 +599,7 @@ int main(int argc, char *argv[]) } SDL_SetHintWithPriority(SDL_HINT_IME_SHOW_UI, "1", SDL_HINT_OVERRIDE); + SDL_SetHintWithPriority(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, "1", SDL_HINT_OVERRIDE); /* We already do the button swapping in ButtonGlyphs, disable SDL's swapping */ SDL_SetHintWithPriority(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0", SDL_HINT_OVERRIDE);