Add M9.8c launcher, legend, labelled inspector and click selection

Toolkit-independent launcher, selection, label and outcome-log models with
bounded inputs and fixed error text; Dear ImGui overlay in the native adapter
with toolkit-first event routing and capture; engineering panels for fixture vs
dev region, legend, inspector, session outcomes, notices and dialog. Additive
SessionClient::unreachable_attempts() bounds unreachable connects. Docs, CI
targets and validation evidence updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-02 10:09:11 -04:00
co-authored by Claude Opus 5.5
parent a6e8094f57
commit 897055883a
36 changed files with 2106 additions and 200 deletions
+104
View File
@@ -4,6 +4,8 @@
#include <array>
#include <cmath>
#include <cstdio>
#include <filesystem>
#include <imgui.h>
#include <limits>
#include <source_location>
#include <stdexcept>
@@ -246,12 +248,114 @@ void native_input() {
CHECK(required(app->sample_intention(51)).move_y == 0);
CHECK(app->present(frame) == Step::rendered);
}
// M9.8c: the toolkit sees input first. A click that operates a widget never selects
// through it; keyboard focus in a text field suppresses world movement; releasing that
// focus requires a fresh key press (nothing is synthesized from held keys).
void toolkit_capture() {
const auto frame = fixture();
auto result = Application::open({320, 240, false, "software"});
CHECK(result);
auto app = std::move(result.value());
CHECK(app->poll_events());
const auto id = SDL_GetWindowID(window());
send(SDL_EVENT_WINDOW_FOCUS_GAINED, id);
int presses = 0;
bool text_focus = false;
std::array<char, 32> text{};
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;
if (text_focus) {
ImGui::SetKeyboardFocusHere();
ImGui::InputText("name", text.data(), text.size());
}
ImGui::End();
});
auto mouse = [id](SDL_EventType type, float x, float y) {
SDL_Event event{};
event.type = type;
if (type == SDL_EVENT_MOUSE_MOTION) {
event.motion.windowID = id;
event.motion.x = x;
event.motion.y = y;
} else {
event.button.windowID = id;
event.button.button = SDL_BUTTON_LEFT;
event.button.down = type == SDL_EVENT_MOUSE_BUTTON_DOWN;
event.button.clicks = 1;
event.button.x = x;
event.button.y = y;
}
CHECK(SDL_PushEvent(&event));
};
const auto click = [&](float x, float y) {
mouse(SDL_EVENT_MOUSE_MOTION, x, y);
CHECK(app->poll_events() && app->present(frame) == Step::rendered); // Toolkit hovers.
mouse(SDL_EVENT_MOUSE_BUTTON_DOWN, x, y);
CHECK(app->poll_events() && app->present(frame) == Step::rendered);
mouse(SDL_EVENT_MOUSE_BUTTON_UP, x, y);
CHECK(app->poll_events() && app->present(frame) == Step::rendered);
return app->take_navigation().click;
};
// Over the widget: the button activates once, the world sees no click.
// The panel exists before the user clicks (as every application panel does).
CHECK(app->present(frame) == Step::rendered && app->present(frame) == Step::rendered);
CHECK(!click(60, 30) && presses == 1 && app->ui_wants_pointer());
// Open world: a click is delivered once, then consumed.
const auto world = click(260, 200);
CHECK(world && world->x == 260 && world->y == 200 && presses == 1);
CHECK(!app->take_navigation().click);
// A drag is not a click.
mouse(SDL_EVENT_MOUSE_MOTION, 260, 200);
CHECK(app->poll_events() && app->present(frame) == Step::rendered);
mouse(SDL_EVENT_MOUSE_BUTTON_DOWN, 260, 200);
mouse(SDL_EVENT_MOUSE_BUTTON_UP, 290, 200);
CHECK(app->poll_events() && !app->take_navigation().click);
auto key = [id](SDL_Scancode scancode, bool down) {
SDL_Event event{};
event.type = down ? SDL_EVENT_KEY_DOWN : SDL_EVENT_KEY_UP;
event.key.windowID = id;
event.key.scancode = scancode;
CHECK(SDL_PushEvent(&event));
};
key(SDL_SCANCODE_W, true);
CHECK(app->poll_events() && required(app->sample_intention(100)).move_y == 1000);
// A focused text field takes the keyboard: held movement stops, typing never moves.
text_focus = true;
// Focus requests take effect over the next toolkit frames; wait a bounded number.
for (int i = 0; i < 5 && !app->ui_captured(); ++i)
CHECK(app->present(frame) == Step::rendered && app->poll_events());
CHECK(app->ui_captured());
key(SDL_SCANCODE_W, true);
CHECK(app->poll_events() && app->ui_captured());
CHECK(required(app->sample_intention(101)).move_y == 0);
// Focus leaves the field: capture releases, but only a fresh press moves again.
text_focus = false; // The field is no longer submitted, so it loses focus.
for (int i = 0; i < 5 && app->ui_captured(); ++i)
CHECK(app->present(frame) == Step::rendered && app->poll_events());
CHECK(!app->ui_captured());
CHECK(required(app->sample_intention(102)).move_y == 0);
CHECK(app->poll_events());
key(SDL_SCANCODE_W, true);
CHECK(app->poll_events() && required(app->sample_intention(103)).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);
CHECK(std::filesystem::file_size(shot) > std::uintmax_t{320} * 240);
std::filesystem::remove(shot);
CHECK(!app->request_screenshot(""));
}
} // namespace
int main() try {
client_controls_tests();
frame_contract();
lifecycle();
native_input();
toolkit_capture();
return 0;
} catch (const std::exception& e) {
std::fprintf(stderr, "%s: %s\n", e.what(), SDL_GetError());