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.
67 lines
2.5 KiB
C
67 lines
2.5 KiB
C
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#include <windows.h>
|
|
#include "../menu_bridge.h"
|
|
|
|
static HWND editor;
|
|
static BOOL typed;
|
|
|
|
static BOOL marker_exists(const WCHAR *variable) {
|
|
WCHAR path[4096];
|
|
return GetEnvironmentVariableW(variable, path, 4096) &&
|
|
GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES;
|
|
}
|
|
|
|
static void marker(const WCHAR *variable) {
|
|
WCHAR path[4096];
|
|
if (!GetEnvironmentVariableW(variable, path, 4096)) return;
|
|
HANDLE file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
|
if (file != INVALID_HANDLE_VALUE) CloseHandle(file);
|
|
}
|
|
|
|
static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM lp) {
|
|
if (message == WM_TIMER && !typed && marker_exists(L"WINE_ACCESS_READER_WAITING")) {
|
|
typed = TRUE;
|
|
const WCHAR *text = L"abbacdef";
|
|
for (const WCHAR *cursor = text; *cursor; ++cursor)
|
|
SendMessageW(editor, WM_CHAR, *cursor, 1);
|
|
WCHAR actual[32];
|
|
DWORD start = 0, end = 0;
|
|
GetWindowTextW(editor, actual, 32);
|
|
SendMessageW(editor, EM_GETSEL, (WPARAM)&start, (LPARAM)&end);
|
|
if (lstrcmpW(actual, text) || start != 8 || end != 8) ExitProcess(2);
|
|
marker(L"WINE_ACCESS_READER_TYPED");
|
|
return 0;
|
|
}
|
|
if (message == WM_TIMER && typed && marker_exists(L"WINE_ACCESS_READER_RESUME")) {
|
|
KillTimer(window, 1);
|
|
SendMessageW(editor, WM_CHAR, 'z', 1);
|
|
return 0;
|
|
}
|
|
if (message == WM_DESTROY) { PostQuitMessage(0); return 0; }
|
|
return DefWindowProcW(window, message, wp, lp);
|
|
}
|
|
|
|
int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show) {
|
|
(void)previous; (void)show;
|
|
if (lstrcmpA(args, "quit-helper") == 0) {
|
|
DWORD thread = GetWindowThreadProcessId(FindWindowW(WINE_ACCESS_MENU_CLASS, NULL), NULL);
|
|
return thread && PostThreadMessageW(thread, WM_QUIT, 0, 0) ? 0 : 3;
|
|
}
|
|
WNDCLASSW cls = {0};
|
|
cls.hInstance = instance; cls.lpfnWndProc = window_proc;
|
|
cls.lpszClassName = L"WineReaderStallFixture";
|
|
RegisterClassW(&cls);
|
|
HWND window = CreateWindowW(cls.lpszClassName, L"Reader stall fixture",
|
|
WS_OVERLAPPEDWINDOW, 100, 100, 500, 300, NULL, NULL, instance, NULL);
|
|
editor = CreateWindowW(L"Edit", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
|
|
10, 10, 300, 30, window, NULL, instance, NULL);
|
|
ShowWindow(window, SW_SHOW); SetForegroundWindow(window); SetFocus(editor);
|
|
SetTimer(window, 1, 10, NULL);
|
|
MSG message;
|
|
while (GetMessageW(&message, NULL, 0, 0) > 0) {
|
|
TranslateMessage(&message); DispatchMessageW(&message);
|
|
}
|
|
return 0;
|
|
}
|