aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 74e607a6853f90d4cc66577d72681c5a5e25faa3
parent b84d3ba8bfda582406cd7c4b13d9a5cb9fba5c05
Author: anon <anon@example.com>
Date:   Sat, 24 Oct 2026 00:53:32 +0000

Separate browser text input from message-loop wakeups

Diffstat:
MTODO.md | 15++++++++++++++-
Mclient/runtime/linux_window.c | 5+++--
Mclient/tests/browser_camera.c | 44++++++++++++++++++++++++++++++++++++++++++++
Mdocs/team-chat.md | 12+++++++-----
4 files changed, 68 insertions(+), 8 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -817,8 +817,21 @@ and server restarts. Turn every reproduced bug into a focused regression test. before changing the adapter. Evidence: `local/team-leadership-smoke/menu-audit.md`. The Team chat run also reproduced the missing popup with hardware OpenGL on the GPU, including a single remaining WASM page; hover mode25 was - present. Closing extra pages did not resolve this occurrence. Live timing + present. Closing extra pages did not resolve this occurrence. Failed-attempt timing remains unmeasured: `local/team-chat-research/menu-input-state.json`. + A guarded held-button run on the rebuilt client now records 16-18ms AAR + deltas, RightPress/event351 and a persistent native icon menu. Releasing over + Kick removes both pair members and their Team channels. CCR timing is + unchanged; this does not attribute earlier misses to the wakeup defect. + Evidence: `local/input-timing-research/native-timing-held-final.json`. + Also cover Ctrl-down/click/Ctrl-up in one queued SDL batch, verifying both + mouse flags and per-message keyboard state, plus rapid Enter/text batching. +- [x] Keep browser message-loop wakeups out of native text input. Check: + `PostMessageA` and `PostQuitMessage` produce their requested messages without + spurious `WM_CHAR` NUL; explicit composed slash and NUL remain intact. + The real WASM input fixture fails on the old adapter and passes after separating + composed-character events. Native and browser-control regressions pass. + Evidence: `local/input-timing-research/camera-red.json` and `camera-green.json`. - [x] Prevent browser wheel camera gestures from activating native GUI items. Check: wheel/trackpad input over inventory cannot equip or use the hovered item; world-camera gestures still work. A WASM armor test reproduced a wheel diff --git a/client/runtime/linux_window.c b/client/runtime/linux_window.c @@ -972,7 +972,8 @@ EMSCRIPTEN_KEEPALIVE void browser_input_key(int key, int down, int repeat, int m EMSCRIPTEN_KEEPALIVE void browser_input_character(unsigned character) { - SDL_Event event = {.type = SDL_USEREVENT}; + /* Keep composed characters separate from message-loop wakeups. */ + SDL_Event event = {.type = SDL_USEREVENT + 1}; event.user.code = character; if (SDL_PushEvent(&event) != 1) abort(); } @@ -1010,7 +1011,7 @@ static void process_event(const SDL_Event *event) if (!client.handle) return; #ifdef __EMSCRIPTEN__ /* HTML input supplies composed text; physical keys use TranslateMessage. */ - if (event->type == SDL_USEREVENT) { + if (event->type == SDL_USEREVENT + 1) { queue_message(client.handle, 0x102, event->user.code, 1, 0, 0); return; } diff --git a/client/tests/browser_camera.c b/client/tests/browser_camera.c @@ -185,6 +185,47 @@ static void browser_controls_preserve_key_and_text_order(void) assert(!call("PeekMessageA", 5, peek)); } +static void posted_message_wake_does_not_type_a_character(void) +{ + uint32_t output = 0x50003000; + uint32_t posted[] = {window, 0x8001, 123, 456}; + uint32_t peek[] = {output, window, 0, 0, 1}; + + assert(call("PostMessageA", 4, posted)); + assert(call("PeekMessageA", 5, peek)); + + assert(MEM32(output + 4) == 0x8001); + assert(MEM32(output + 8) == 123 && MEM32(output + 12) == 456); + assert(!call("PeekMessageA", 5, peek)); +} + +static void composed_slash_and_nul_remain_distinct_from_wakeups(void) +{ + uint32_t output = 0x50003000; + uint32_t peek[] = {output, window, 0, 0, 1}; + + browser_input_character('/'); + browser_input_character(0); + assert(call("PeekMessageA", 5, peek)); + + assert(MEM32(output + 4) == 0x102 && MEM32(output + 8) == '/'); + assert(call("PeekMessageA", 5, peek)); + assert(MEM32(output + 4) == 0x102 && MEM32(output + 8) == 0); + assert(!call("PeekMessageA", 5, peek)); +} + +static void quit_wake_does_not_type_a_character(void) +{ + uint32_t output = 0x50003000, code = 73; + uint32_t peek[] = {output, 0, 0, 0, 1}; + + call("PostQuitMessage", 1, &code); + assert(call("PeekMessageA", 5, peek)); + + assert(MEM32(output + 4) == 0x12 && MEM32(output + 8) == 73); + assert(!call("PeekMessageA", 5, peek)); +} + static void touch_drag_preserves_the_press_position(void) { browser_input_motion(100, 20); @@ -336,6 +377,9 @@ int main(void) touch_drag_preserves_the_press_position(); touch_camera_accumulates_motion_after_recentering(); touch_camera_release_preserves_recentered_position(); + posted_message_wake_does_not_type_a_character(); + composed_slash_and_nul_remain_distinct_from_wakeups(); + quit_wake_does_not_type_a_character(); puts("camera: recentering, Ctrl-left-click, native UI wheel routing, focus loss and browser key/text/touch input passed"); return 0; } diff --git a/docs/team-chat.md b/docs/team-chat.md @@ -82,11 +82,13 @@ The full Go suite passed in 299 seconds. All chat/team tests passed twice under the race detector in 144 seconds; the completed Team-chat cases passed twice under the race detector in 117 seconds. Logs are retained alongside the evidence. -The native member popup intermittently failed to open during the kick attempt, -including with one hardware-rendered page. Hover mode25 was present, but live -frame timing was not measured. This run therefore claims automated kick -verification only; the existing native-input follow-up retains that limitation. -No adapter change was inferred from a failed UI action. Faster scripted typing +A guarded native held-button test also verifies Kick: both members lose their +Team channels when the pair dissolves, and the victim displays the native kick +feedback. `local/input-timing-research/native-timing-held-final.json` records +16-18ms AAR deltas, the RightPress/event351 binding and an icon menu that stays +open through the hold transition. Original CCR timing remains unchanged. The +cause of earlier missing popups remains unproven; the separate browser wakeup +correction is not claimed as that cause. Faster scripted typing also lost the first slash after load; separated native key actions supplied the successful command checks, and failed vicinity attempts are excluded from the private-delivery assertions.