Fix M9.8c review findings in the engineering client

Resolve pointer ownership per SDL event so same-batch panel clicks, wheel and
click-to-focus typing never reach the world; keep the Tab toggle independent of
idempotent external capture release; own launcher phase and remote session
together so Local fixture ends any remote attempt; wrap notices beside a
reserved close column within a bounded stack. Adds client-panels test and
host/session, same-batch and host-order Tab regressions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-02 11:10:32 -04:00
co-authored by Claude Opus 5.5
parent 897055883a
commit bb8c2fc359
15 changed files with 571 additions and 55 deletions
+89 -2
View File
@@ -261,13 +261,17 @@ void toolkit_capture() {
send(SDL_EVENT_WINDOW_FOCUS_GAINED, id);
int presses = 0;
bool text_focus = false;
std::array<char, 32> text{};
std::array<char, 32> text{}, field{};
ImVec2 field_min{}, field_max{};
app->set_overlay([&] {
ImGui::SetNextWindowPos({0, 0}, ImGuiCond_Always);
ImGui::SetNextWindowSize({150, 150}, ImGuiCond_Always);
ImGui::Begin("panel", nullptr, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);
if (ImGui::Button("Press", {130, 40}))
++presses;
ImGui::InputText("field", field.data(), field.size());
field_min = ImGui::GetItemRectMin();
field_max = ImGui::GetItemRectMax();
if (text_focus) {
ImGui::SetKeyboardFocusHere();
ImGui::InputText("name", text.data(), text.size());
@@ -314,12 +318,45 @@ void toolkit_capture() {
mouse(SDL_EVENT_MOUSE_BUTTON_DOWN, 260, 200);
mouse(SDL_EVENT_MOUSE_BUTTON_UP, 290, 200);
CHECK(app->poll_events() && !app->take_navigation().click);
// Same batch, no settling frame: the pointer was last over the world, then moves
// onto the panel and clicks. Ownership is resolved per event, so the world sees
// nothing and the widget still activates on the toolkit's next frames.
mouse(SDL_EVENT_MOUSE_MOTION, 260, 200);
CHECK(app->poll_events() && app->present(frame) == Step::rendered && !app->ui_wants_pointer());
mouse(SDL_EVENT_MOUSE_MOTION, 60, 30);
mouse(SDL_EVENT_MOUSE_BUTTON_DOWN, 60, 30);
mouse(SDL_EVENT_MOUSE_BUTTON_UP, 60, 30);
CHECK(app->poll_events() && !app->take_navigation().click);
for (int i = 0; i < 5 && presses == 1; ++i)
CHECK(app->present(frame) == Step::rendered && app->poll_events());
CHECK(presses == 2 && !app->take_navigation().click);
// Same for the wheel: moving onto the panel and scrolling never zooms the world.
mouse(SDL_EVENT_MOUSE_MOTION, 260, 200);
CHECK(app->poll_events() && app->present(frame) == Step::rendered);
SDL_Event wheel{};
wheel.type = SDL_EVENT_MOUSE_WHEEL;
wheel.wheel.windowID = id;
wheel.wheel.y = 3;
wheel.wheel.mouse_x = 60;
wheel.wheel.mouse_y = 30;
mouse(SDL_EVENT_MOUSE_MOTION, 60, 30);
CHECK(SDL_PushEvent(&wheel));
CHECK(app->poll_events() && app->take_navigation().wheel == 0);
CHECK(app->present(frame) == Step::rendered);
// ...while the same wheel over the world still zooms.
wheel.wheel.mouse_x = 260;
wheel.wheel.mouse_y = 200;
mouse(SDL_EVENT_MOUSE_MOTION, 260, 200);
CHECK(SDL_PushEvent(&wheel));
CHECK(app->poll_events() && app->take_navigation().wheel == 3);
CHECK(app->present(frame) == Step::rendered);
auto key = [id](SDL_Scancode scancode, bool down) {
auto key = [id](SDL_Scancode scancode, bool down, bool repeat = false) {
SDL_Event event{};
event.type = down ? SDL_EVENT_KEY_DOWN : SDL_EVENT_KEY_UP;
event.key.windowID = id;
event.key.scancode = scancode;
event.key.repeat = repeat;
CHECK(SDL_PushEvent(&event));
};
key(SDL_SCANCODE_W, true);
@@ -342,6 +379,56 @@ void toolkit_capture() {
CHECK(app->poll_events());
key(SDL_SCANCODE_W, true);
CHECK(app->poll_events() && required(app->sample_intention(103)).move_y == 1000);
key(SDL_SCANCODE_W, false);
CHECK(app->poll_events() && required(app->sample_intention(104)).move_y == 0);
// Click-to-focus and typing in one batch: the field is not yet reported focused,
// yet keys after a press on the panel never move the world.
const float fx = (field_min.x + field_max.x) / 2, fy = (field_min.y + field_max.y) / 2;
mouse(SDL_EVENT_MOUSE_MOTION, fx, fy);
mouse(SDL_EVENT_MOUSE_BUTTON_DOWN, fx, fy);
mouse(SDL_EVENT_MOUSE_BUTTON_UP, fx, fy);
key(SDL_SCANCODE_W, true);
CHECK(app->poll_events() && !app->take_navigation().click);
CHECK(required(app->sample_intention(105)).move_y == 0);
for (int i = 0; i < 5 && !app->ui_captured(); ++i)
CHECK(app->present(frame) == Step::rendered && app->poll_events());
CHECK(app->ui_captured() && required(app->sample_intention(106)).move_y == 0);
// A world click unfocuses the field; capture releases and fresh presses move again.
mouse(SDL_EVENT_MOUSE_MOTION, 260, 200);
mouse(SDL_EVENT_MOUSE_BUTTON_DOWN, 260, 200);
mouse(SDL_EVENT_MOUSE_BUTTON_UP, 260, 200);
CHECK(app->poll_events());
for (int i = 0; i < 5 && app->ui_captured(); ++i)
CHECK(app->present(frame) == Step::rendered && app->poll_events());
CHECK(!app->ui_captured());
static_cast<void>(app->take_navigation());
CHECK(app->poll_events());
key(SDL_SCANCODE_W, true);
CHECK(app->poll_events() && required(app->sample_intention(107)).move_y == 1000);
key(SDL_SCANCODE_W, false);
CHECK(app->poll_events());
// Host order (main loop): poll -> set_ui_capture(false) outside modals -> sample ->
// present. The idempotent external release must not cancel the Tab toggle.
const auto host_frame = [&](std::uint64_t tick) {
CHECK(app->poll_events());
app->set_ui_capture(false);
const auto intention = required(app->sample_intention(tick));
CHECK(app->present(frame) == Step::rendered);
return intention;
};
key(SDL_SCANCODE_TAB, true);
key(SDL_SCANCODE_TAB, false);
CHECK(host_frame(110).move_y == 0 && app->ui_captured());
for (std::uint64_t tick = 111; tick < 115; ++tick) {
key(SDL_SCANCODE_W, true);
CHECK(host_frame(tick).move_y == 0 && app->ui_captured());
}
key(SDL_SCANCODE_TAB, true); // Second deliberate toggle; W stays held physically.
CHECK(host_frame(115).move_y == 0 && !app->ui_captured());
key(SDL_SCANCODE_W, true, true); // A repeat is not a fresh press.
CHECK(host_frame(116).move_y == 0);
key(SDL_SCANCODE_W, true);
CHECK(host_frame(117).move_y == 1000);
// Screenshot hook writes the composed frame (engineering visual review).
const auto shot = std::filesystem::temp_directory_path() / "evo-toolkit-capture.bmp";
CHECK(app->request_screenshot(shot.string()) && app->present(frame) == Step::rendered);