Files
wine-access/reader_events.h
deedra 7d3ac09ea1 Keep Wine editor feedback responsive during reader reply stalls
PresentAccessibleEvent previously waited synchronously for the reader on
Wine Access's message-loop thread. A slow D-Bus acknowledgment prevented
that thread from receiving subsequent WM_COPYDATA editor notifications.
The hooks time out after 50 ms, so feedback disappeared even though the
application accepted the input. With a 350 ms delayed focus reply, the
original helper inserted all of abbacdef but forwarded only e and f.

Move menu, editor and standard-control event delivery to one reader worker.
Keep a FIFO of at most 128 pending events, retain each variant and the bus
connection until delivery completes, and preserve focus-before-text order.
Keep the 500 ms reply deadline and cancel outstanding calls during normal
shutdown without making the event thread wait for the reader. Event-thread
success now means queued; controller RPC calls retain their synchronous
reader status behavior.

Retain the most recent focus dependency on the worker. After a transport
failure, re-establish that focus before sending dependent editor actions.
Treat a successful false reply as a completed exchange because filtering
can suppress presentation while still establishing focus. Never replay a
timed-out text action. Report transport failures, recovery and queue
overflow without including event contents in diagnostics.

Add a native editor fixture and a private-session D-Bus integration runner
for delayed replies, reply timeouts, failed initial focus, repeated typing,
event order, unchanged native text/caret, and shutdown with a withheld
reply. Wait for editor-hook attachment before triggering typing so the
32-bit companion is exercised reliably. Document queue behavior, limits,
regression commands and remaining live acceptance checks.

Validation performed sequentially on a private Xorg dummy display with
disposable Wine prefixes and recording reader services:

- cmake --build build --parallel
- python3 tests/reader_stall_integration.py --build-dir build
- The reader-stall check with --32-bit, --timeout, --focus-error, and
  --32-bit --focus-error
- ctest --test-dir build --output-on-failure: all four checks passed
- python3 tests/menu_integration.py --build-dir build with --fixture menu,
  edit, edit --32-bit, edit --restart-helper, notepad, controls, and
  list --32-bit
- python3 tests/event_stall_integration.py --build-dir build
- python3 tests/controller_integration.py --build-dir build
- git diff --check

The delayed-reply regression failed against the original synchronous
helper and passed after the worker change. The failed-focus scenario also
failed before dependency recovery was added and passed afterward.

These recordings establish the shared failure paths, not the cause of
every live MUSHclient pause or audible speech and physical braille
acceptance. Live checks remain for command typing, incoming plugin speech,
output-buffer arrows, menus, switching between Wine and Linux, reader
restart, and protected fields. An unavailable reader can still cause
feedback loss or bounded queue overflow.
2026-10-13 05:26:11 -07:00

24 lines
621 B
C++

// SPDX-License-Identifier: LGPL-2.1-or-later
#pragma once
#include "reader_endpoint.h"
#include <gio/gio.h>
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#include <memory>
// Event callbacks enqueue copied data. One worker preserves event order while
// waiting for reader acknowledgments, leaving WM_COPYDATA reception available.
class ReaderEventQueue {
public:
~ReaderEventQueue();
bool start(GDBusConnection *connection, const ReaderEndpoint &endpoint);
bool submit(GVariant *parameters);
void stop();
private:
struct State;
std::shared_ptr<State> state_;
HANDLE worker_ = nullptr;
};