Attempt to fix Android async text input

This commit is contained in:
pelya
2017-04-02 01:57:35 +03:00
committed by Sergii Pylypenko
parent 40bbbe8873
commit 362d839e08

View File

@@ -47,6 +47,7 @@ enum OskActivation {
};
static char _android_text_input[512];
static bool _android_text_input_active = false;
static const NWidgetPart _nested_land_info_widgets[] = {
@@ -775,8 +776,9 @@ void QueryString::HandleEditBox(Window *w, int wid)
if (w->window_class == WC_OSK) w->InvalidateData();
}
#ifdef __ANDROID__
if (SDL_IsScreenKeyboardShown(NULL)) {
if (_android_text_input_active) {
if (SDL_ANDROID_GetScreenKeyboardTextInputAsync(_android_text_input, sizeof(_android_text_input)) == SDL_ANDROID_TEXTINPUT_ASYNC_FINISHED) {
_android_text_input_active = false;
this->text.Assign(_android_text_input);
w->OnEditboxChanged(wid);
}
@@ -964,8 +966,10 @@ void QueryString::ClickEditBox(Window *w, Point pt, int wid, int click_count, bo
}
#ifdef __ANDROID__
strecpy(_android_text_input, this->text.buf, lastof(_android_text_input));
this->text.DeleteAll();
//this->text.DeleteAll();
_android_text_input_active = true;
if (SDL_ANDROID_GetScreenKeyboardTextInputAsync(_android_text_input, sizeof(_android_text_input)) == SDL_ANDROID_TEXTINPUT_ASYNC_FINISHED) {
_android_text_input_active = false;
this->text.Assign(_android_text_input);
w->OnEditboxChanged(wid);
}