Mobile: tapping the focused edit line re-shows the keyboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-13 11:53:10 +09:00
co-authored by Claude Opus 5.5
parent 445dd06048
commit e0b97c2099
2 changed files with 25 additions and 1 deletions
+14 -1
View File
@@ -721,7 +721,16 @@ ava2::app::AppLoop::Frame RunClient(ava2::app::AppLoop* loop, int argc, char** a
return window && !ava2::IsPlayerGameWindow(window->GetHandler());
}
void UiMouseMove(float x, float y) override { if (wm) wm->RunMouseMove(long(x), long(y)); }
void UiMouseDown(float x, float y) override { if (wm) wm->RunMouseLeftButtonDown(long(x), long(y)); }
bool edit_tapped = false; // a finger went down on the focused edit line
void UiMouseDown(float x, float y) override {
if (!wm) return;
wm->RunMouseLeftButtonDown(long(x), long(y));
// After the user hides the on-screen keyboard (Back / its hide key) the edit keeps
// focus, so the frame loop sees no change; a tap on that edit shows it again.
if (!ava2::IME_IsCaptureInput()) return;
for (auto* w = wm->PickWindow(long(x), long(y)); w; w = w->GetParent())
if (wm->IsFocusWindow(w)) { edit_tapped = true; break; }
}
void UiMouseUp(float x, float y) override { if (wm) ava2::TouchUiMouseUp(*wm, long(x), long(y)); }
void UiDoubleClick(float x, float y) override { if (wm) wm->RunMouseLeftButtonDoubleClick(long(x), long(y)); }
bool UiLongPress(float x, float y) override { return wm && ava2::TouchUiLongPress(*wm, long(x), long(y)); }
@@ -1336,6 +1345,10 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
|| (!view_script.empty() && snapshot.phase == "login");
if (want != SDL_TextInputActive(window.get()))
want ? SDL_StartTextInput(window.get()) : SDL_StopTextInput(window.get());
// SDL_StartTextInput shows the keyboard again when it is active but hidden.
else if (want && touch_sink.edit_tapped && !SDL_ScreenKeyboardShown(window.get()))
SDL_StartTextInput(window.get());
touch_sink.edit_tapped = false;
}
#endif
#ifdef AVA2_HAS_PYTHON