fix(touch): raise the soft keyboard only for a tap on the visible focused EditLine

A chat line keeps the IME focus under a hidden board (interfacemodule
__HideWindows for an NPC dialog, the focus handed back by
UnlockWindow/DeactivateWindow), and IsPointInsideFocusedWindow only
checked its own show flag and rect, so taps on the NPC dialog or the
minimap buttons opened the keyboard. Require the whole parent chain to
render and the picked window to be the focused one or its child.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 17:00:39 +09:00
co-authored by Claude Opus 5.5
parent 78d14776b8
commit 5c8d583b31
3 changed files with 32 additions and 2 deletions
+21
View File
@@ -683,6 +683,27 @@ int main(int argc, char** argv)
CHECK(pump_until(2, [&] { return server->Has("game2:chat 0 hello"); }));
// uichat.__SendTalkingChatPacket only resets the line; a Return on the empty line closes it (eventReturn).
CHECK(py_true("_stream.curPhaseWindow.interface.IsOpenChat() and __import__('ime').GetText(0) == ''"));
// Touch hosts raise the system keyboard only for a tap on the focused, visible EditLine. A chat line
// that keeps the focus under a hidden board (interfacemodule.__HideWindows for an NPC dialog, then the
// focus handed back by UnlockWindow/DeactivateWindow) must not, wherever the tap lands.
{
std::string xywh;
CHECK(py("_line = _stream.curPhaseWindow.interface.wndChat.chatInputSet.chatLine"));
CHECK(PythonBoot::Evaluate("'%d %d %d %d' % (_line.GetGlobalPosition() + (_line.GetWidth(), _line.GetHeight()))",
&xywh, nullptr));
int x = 0, y = 0, w = 0, h = 0;
std::sscanf(xywh.c_str(), "%d %d %d %d", &x, &y, &w, &h);
const int cx = x + w / 2, cy = y + h / 2;
CHECK(w > 0 && h > 0);
CHECK(PythonBoot::TextInputFocused());
CHECK(PythonBoot::IsPointInsideFocusedWindow(cx, cy));
CHECK(!PythonBoot::IsPointInsideFocusedWindow(790, 10));
CHECK(py("_stream.curPhaseWindow.interface.wndChat.Hide()"));
CHECK(PythonBoot::TextInputFocused());
CHECK(!PythonBoot::IsPointInsideFocusedWindow(cx, cy));
CHECK(py("_stream.curPhaseWindow.interface.wndChat.Show()"));
CHECK(PythonBoot::IsPointInsideFocusedWindow(cx, cy));
}
PythonBoot::UIChar(VK_RETURN);
CHECK(pump_until(1, [] { return py_true("not _stream.curPhaseWindow.interface.IsOpenChat()"); }));
}