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
+11
View File
@@ -1636,3 +1636,14 @@ Outstanding:
zone still reach the app. Right and bottom still use the combined insets.
- Verified on the device: the portrait, the Quest/Emote column and the joystick moved about
50 logical px to the left and stay clear of the cutout.
### 2026-10-13 Mobile: tapping an edit line shows the keyboard again
- The frame loop only called `SDL_StartTextInput` when `ime.EnableCaptureInput` state changed.
Once the user hid the on-screen keyboard (Back or the keyboard's hide key), the login edit
kept focus, so tapping the ID or password box changed nothing and the keyboard stayed hidden.
- `HostTouchSink::UiMouseDown` now notes a finger landing on the focused window (or a child of
it) while text is captured. The next frame calls `SDL_StartTextInput` again if the keyboard is
hidden; SDL shows it again without restarting text input.
- Verified on the device (login board): Back hides the keyboard; tapping ID or Password
brings it back; tapping the background does not. Desktop ctest 59/59.
+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