4.3 KiB
Background accessibility events
On Xorg, Cthulhu rejects known background control updates before resolving selected descendants or capturing their text, values, attributes and geometry. The native adapter owns this decision on the GLib thread. It uses the existing foreground window and epoch; there is no additional window ownership cache.
Events from another provider can be rejected using copied bus identities and libatspi's cached role and application name, without querying that provider. Events from another window on the same provider undergo the existing window correlation before content capture. Lifecycle invalidation still runs, but a background provider no longer clears another provider's cached document lines.
Window creation, activation, deactivation, destruction and defunct events keep their existing handling. Native alerts, notification daemons and supported Steam toasts retain their notification paths. Menu popups retain existing foreground checks. Same-provider autocomplete relations and tooltip candidates continue through the existing event-loop ownership checks; they do not acquire focus merely by passing the early filter.
When notification metadata or a detached document's containing window is unknown, the adapter retains the existing validation path. The optimization does not introduce an X11 ownership requirement for native Wayland sessions.
Orca's src/orca/event_manager.py was used as a reference for keeping global
window monitoring and filtering noisy content events before presentation.
Automated checks
Run from the repository root with the normal native build dependencies:
go test ./... -count=1
go test -race ./internal/atspi ./internal/app ./internal/review -count=1
python3 tests/native_test_session.py env CTHULHU_NATIVE_BACKGROUND_EVENTS=1 CTHULHU_NATIVE_WAYLAND_POLICY=1 go test -race ./internal/atspi -run '^TestNative(BackgroundEventFiltering|WaylandForegroundPolicy)$' -count=1 -v -timeout=40s
python3 tests/native_webscripts.py
CTHULHU_NATIVE_BROWSER_TESTS=browser,tabs,live,tooltips python3 tests/native_browser.py
go build -o /tmp/cthulhu-background-events ./cmd/cthulhu
CTHULHU_BINARY=/tmp/cthulhu-background-events python3 tests/native_ownership.py
The flood regression uses two real GTK providers, then two windows on one provider. Each burst changes the table selection 300 times. A private D-Bus monitor asserts that the rejected updates cause no Selection, Table, Text or Value interface calls. The explicit alert used as a completion marker is excluded from this content-query assertion. Returning to the noisy window must deliver its current table selection. The separate cache regression verifies that invalidation preserves other providers' document lines.
All native checks use disposable X servers and private D-Bus/runtime sockets. They do not replace the active desktop reader. Browser checks cover address suggestions, page controls, tabs, live regions and tooltips. Ownership checks cover GTK/Qt menus, a GTK menu popup, dialogs, same-process windows, empty workspaces and Brave window recovery. Notification checks preserve Steam toast capture while rejecting ordinary background Chromium text changes.
Live acceptance
Private fixtures do not establish audible speech, physical Braille or actual FastSMRW update latency. After reviewing the diff, preserve the current debug log and rebuild/start the candidate through the normal local launcher when ready to replace the reader.
- Read headings and lines in Brave while FastSMRW receives new items. Compare responsiveness with quiet periods. Background selection changes should not delay reading or take speech/focus ownership.
- Switch to FastSMRW and move through results. Confirm the current selection is spoken; open its Open Links popup, move between links, and close it.
- Switch between two windows from the same application. Open and close a dialog and a menu; confirm speech follows the active control.
- In Brave, type into the address bar and move through suggestions. Return to the page, switch tabs, and verify normal editing and reading still work.
- Check supported background notifications. If using Braille, confirm it follows the foreground control and still displays supported notifications.
Preserve a fresh log if lag or a missing announcement remains, with the time and the key or update that triggered it. Debug logs can contain private text.