SDL-free action/HID-key bindings with conflict validation, a staging editor and a versioned all-or-nothing controls file (ADR-0085). The adapter maps keys through the bindings, releases and drains on rebinding, and captures the chosen key ahead of the toolkit and world. The client adds a Controls panel, key hints, startup loading with a bounded rejection notice, and --controls/--show-controls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
5.5 KiB
Markdown
86 lines
5.5 KiB
Markdown
# M9.8b/c UI state, launcher and event bounds
|
|
|
|
Owned, toolkit-independent state; all calls on the client main thread. No authority
|
|
or simulation state. Time is explicit monotonic milliseconds supplied by the host.
|
|
|
|
Notifications: at most eight, text at most 240 bytes; reject invalid/oversized input,
|
|
expire by deadline, dismiss by unique id. Overflow evicts oldest and increments a
|
|
visible saturating counter. Notifications are not durable outcome history.
|
|
Dialogs: one active modal, title at most 96 bytes and body at most 240; opening a
|
|
second fails. Close requires the matching id so a stale click cannot close a newer
|
|
dialog. IDs never wrap. No credentials or grant bytes enter display messages.
|
|
|
|
SessionClient keeps at most 1024 queued ClientEvents. At 766 regular events it emits
|
|
a local backpressure event, disconnects, and has room for loss plus 256 unknown
|
|
intentions. It preserves all previously queued events and pauses reconnect until
|
|
take_events drains the queue. This is a local condition, not a protocol change.
|
|
Unprocessed wire outcomes remain unknown, never assumed failed or committed.
|
|
|
|
The native adapter's externally requested capture cannot be disabled by the legacy
|
|
Tab toggle. Releasing capture drains already queued input before new world actions.
|
|
M9.8c renders these through the toolkit overlay (below).
|
|
|
|
## M9.8c launcher, selection and panels
|
|
|
|
Toolkit-independent models (src/client/ui, tested by `client-ui-model`):
|
|
|
|
- **Launcher** (`launcher.hpp`): phases choosing, fixture, connecting, connected,
|
|
failed. Fields are at most 1024 bytes; endpoint is `host:port` with port 1-65535.
|
|
Files are read only when Connect is pressed: the CA at most 64 KiB and PEM-shaped,
|
|
the grant bundle 1-64 whole 108-byte records. Nothing is persisted; material lives
|
|
only in the session client. Errors are an enum with fixed text that never contains
|
|
paths or file bytes. Before the first Welcome, three losses (including refused
|
|
TCP/TLS attempts, counted by `SessionClient::unreachable_attempts()`) fail as
|
|
unreachable; a refused grant or exhausted bundle fails at once. Failed offers
|
|
Retry/Cancel; Cancel drops the session (its unresolved intentions become unknown).
|
|
- **Selection** (`selection.hpp`): topmost organism under the click, else the
|
|
habitat cell, else none. A selected organism absent from the latest view is
|
|
cleared; with no view at all the selection is kept but shows nothing.
|
|
- **Labels** (`labels.hpp`): value, present zero, missing (requested, no value), not
|
|
requested and undefined moisture are distinct kinds and texts. Freshness is
|
|
printed as current, stale or none.
|
|
- **Outcome log** (`outcome_log.hpp`): last 64 intentions by sequence with sent,
|
|
admitted, rejected, durable, not committed or unknown. It is the visible record;
|
|
notifications are not.
|
|
|
|
Native adapter (`Application`): toolkit events are processed first. Keyboard focus
|
|
in a widget (reported by the toolkit's last frame) captures world keys. Pointer
|
|
ownership is resolved per event against the panel rectangles retained from the
|
|
last frame (and any open popup), so a move onto a panel followed by a press or wheel
|
|
in the same SDL batch never reaches the world; a press that begins on a panel owns
|
|
the button until release. After a press on a panel, world key-downs in the same
|
|
batch are dropped (releases still pass) because that press may focus a text field
|
|
before the toolkit can report it; those keys need a fresh press. A click is a left
|
|
press and release within 4 pixels, both outside any panel. Capture changes from
|
|
toolkit focus release world actions and require fresh presses. External capture
|
|
(launcher, modal) and the Tab toggle are independent: Tab is ignored while external
|
|
capture holds, and an external release (sent every host frame outside a modal) does
|
|
not cancel the toggle. The overlay callback runs after
|
|
world drawing; `request_screenshot` saves the next frame as BMP (engineering review).
|
|
Toolkit settings files and logs are disabled (`IniFilename`/`LogFilename` null).
|
|
|
|
Host ownership (`session_host.hpp`): the launcher phase and the remote session
|
|
change together. Entering the local fixture, Cancel, Disconnect or a launcher
|
|
failure drops the session at once (unresolved intentions become unknown); the
|
|
session is serviced, and intentions sent, only while connecting or connected, so
|
|
nothing runs behind a LOCAL FIXTURE banner. Retry opens a new session.
|
|
|
|
Notices (app panels): newest at the bottom right, at most 320 logical pixels wide
|
|
(narrower viewports shrink them), text wrapped beside a reserved close column. The
|
|
stack stops at 60 % of the viewport height and shows how many notices are not drawn
|
|
and how many were discarded. `client-panels` renders the production panels through
|
|
the adapter and checks notice geometry and close-button dismissal.
|
|
|
|
## M9.8d controls panel
|
|
|
|
Opened from the launcher ("Controls...") or the mode banner. While open the host
|
|
keeps UI capture on, so neither keys nor clicks reach the world. Each slot button
|
|
arms adapter key capture for that slot (other buttons disabled); Escape or "Cancel
|
|
capture" ends it without a change, focus loss cancels it. A conflicting or
|
|
unbindable key is refused with fixed text naming the other action; the draft is
|
|
unchanged. Apply validates the whole set, installs it (held actions released) and
|
|
saves; Reset defaults and Cancel only change the draft/close. A save failure leaves
|
|
the bindings active for the session with a warning notice. The Legend hint lists
|
|
the keys in force. `client-panels` checks the panel geometry and that a slot click
|
|
requests capture without a world click.
|