Files

180 lines
8.5 KiB
Markdown

# Wine Access for Orca
An Orca 51 user extension that lets stock Orca use the Wine Access helper.
It publishes the Wine methods on Orca's own D-Bus service connection and
starts one helper per active Wine prefix, so Orca reads standard Wine
controls, native menus, Edit and Scintilla editing feedback, NVDA
Controller/Tolk speech and braille, UIA notifications, and dialog messages.
## Install
### Arch Linux package
The `wine-access-git` package installs the extension's Python files under
`/usr/share/wine-access/orca/wine_access/`. Orca 51 currently discovers
third-party extensions only in the user's extension directory, so each user
links the shared copy and approves it:
```sh
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/orca/extensions"
ln -sT /usr/share/wine-access/orca/wine_access \
"${XDG_DATA_HOME:-$HOME/.local/share}/orca/extensions/wine_access"
orca --approve-extension wine_access
```
Restart Orca afterward. If `wine_access` already exists in the user extension
directory, move that earlier copy aside before creating the link. The commands
above leave an existing destination untouched. Package upgrades update the
shared copy; approve it again whenever its contents change. Orca 51 or later
must be installed separately; it is an optional package dependency.
### Manual installation
1. Build and install the helper with `./build.sh` while Orca 51 or later is
installed. The script installs the extension files under
`$prefix/share/wine-access/orca/wine_access/` (`~/.local/share/...` for a
user build, `/usr/share/...` for a system build) and prints the remaining
commands. If Orca was not installed at build time, rerun `./build.sh`.
2. Link that copy into your Orca extension directory, as in the package
instructions above, using your installation prefix. For a user build:
```sh
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/orca/extensions"
ln -sT "$HOME/.local/share/wine-access/orca/wine_access" \
"${XDG_DATA_HOME:-$HOME/.local/share}/orca/extensions/wine_access"
```
Copying `orca/wine_access/` from the source tree to
`~/.local/share/orca/extensions/` also works, but the copy is not updated
by later builds.
3. Approve it with `orca --approve-extension wine_access` and restart Orca.
Approval records a hash of the package; approve again after any update.
Only one reader's helper can run on a Wine desktop/prefix at a time. Stop
Cthulhu's Wine helper before using Orca for that prefix, and disable this
extension before returning to Cthulhu. The extension does not stop or replace
Cthulhu-managed helpers; the helper's existing singleton guard rejects a
second instance. Installing these files alone does not change Cthulhu's
default endpoint or helper startup.
The extension looks for `wine-access.exe` in `$WINE_ACCESS_HELPER`,
`~/.local/libexec/wine-access/`, `~/.nix-profile/libexec/wine-access/`,
Home Manager's current generation, the NixOS user and system profiles,
`/usr/local/libexec/wine-access/`, `/usr/libexec/wine-access/`, and then
`PATH`.
## Endpoint
| | |
| --- | --- |
| Bus name | `org.gnome.Orca1.Service` (owned by Orca) |
| Object | `/org/gnome/Orca1/Service/WineAccess` |
| Interface | `org.gnome.Orca1.WineAccess` |
It implements `SpeakText`, `CancelSpeech`, `BrailleMessage`, `SpeakSsml`
(answering `ERROR_CALL_NOT_IMPLEMENTED`), `PresentAccessibleEvent`, and the
optional review methods `RegisterWineReviewProvider` and
`PresentWineReviewFocus`. The extension class has no Orca-decorated commands,
so Orca publishes nothing of its own at that module path.
## Helper supervision
Every two seconds the extension scans `/proc` for the user's Wine processes
(`wine`, `wine64`, their preloaders and Nix `.wine-wrapped` launchers),
ignoring Wine's own service processes and anything outside Orca's D-Bus
session and display. For each prefix (`WINEPREFIX`,
`STEAM_COMPAT_DATA_PATH/pfx`, or `~/.wine`) it starts:
```sh
wine-access.exe --reader orca --reader-path /org/gnome/Orca1/Service/WineAccess \
--reader-interface org.gnome.Orca1.WineAccess
```
with the program's own loader, display and bus, and
`ORCA_WINE_ACCESS_MANAGED=1`. For Steam Play and Protontricks launches the
loader is resolved to the game's real Proton `files/bin/wine` (Protontricks'
proxy `WINELOADER` is bypassed), the game's `WINEESYNC`/`WINEFSYNC` are
forwarded so the helper joins the running server, and the helper set is
staged as complete sets in separate content-hash directories under the
state directory because the container's wineserver cannot
see a system `/usr/libexec` installation; see the main README's Steam
section.
## Controller-only mode
Some games' anti-tamper code objects to the helper's injected hooks
(Diablo IV's Eidolon component kills the game shortly after it loses
focus when the native hook DLL is present). For those, the extension's
preferences offer controller-only mode: helpers run with
`--no-dialog-reader`, injecting nothing and polling no controls, while
NVDA/Tolk speech and braille keep working. Enable it for all
applications there, or list executable names (e.g. `Diablo IV.exe`) to
apply it per game. Every helper receives the full list at startup; both
native hook hosts check the target executable before attachment, including
when a game starts after its launcher. The supervisor also switches the
prefix's helper to controller-only when it discovers a listed game.
Settings apply to newly started helpers. After changing the list, close the
affected Wine applications, restart Orca to replace existing helpers, and then
relaunch the applications. Restarting only the helper cannot remove hook DLLs
already pinned inside an application. Names are matched case-insensitively by
executable basename; directory paths are not accepted.
`WINE_ACCESS_NO_DIALOG_READER=1` in Orca's environment forces the same
mode for every helper, for testing.
A helper stops 10 seconds after its prefix
goes idle and restarts with exponential backoff after quick failures. Helpers
run in their own session and survive an Orca restart, so a newly loaded
extension retires a marked helper it did not start before starting its own.
Helper output is appended to
`~/.local/state/orca-wine-access/<prefix hash>.log`.
## Presentation
- Focus bursts are coalesced for 50 ms; repeated output within 100 ms is
dropped, and a state event that changes nothing audible stays quiet.
- Values, name and state changes are read for the focused source; selections
may come from another source in the focused window (combo box lists).
- `text` events are presented immediately and never merged, so repeated
characters are heard. Typed characters (`kind=8`) follow Orca's character
echo setting and are skipped when Orca's key echo already spoke the key.
Navigation, selection and deletion reports interrupt speech; single
characters use Orca's capitalization style.
- Password fields: values and editor feedback are never presented.
- Window titles are announced when they change, since Wine windows are not
visible to AT-SPI.
- Dialog messages: when review focus enters a new window with role `dialog`,
the extension captures it once with `CaptureWindow` and presents its
visible, unprotected labels after the focused control. Text that arrives
before that window's focus waits up to 300 ms for it.
## Tests
```sh
python3 -m pytest orca/tests/test_presenter.py orca/tests/test_manager.py \
orca/tests/test_service.py orca/tests/test_review.py
dbus-run-session -- xvfb-run -a python3 orca/tests/integration_test.py --build-dir build
```
The unit tests need `dasbus`. The integration test needs a built tree, Wine,
both MinGW compilers and `widl`; it hosts the extension's interface, presenter,
dialog reader and helper manager under Orca's bus name on a private display
and bus, lets the manager start the helper, runs the Notepad and controller
fixtures, and checks what Orca would present. To check the extension against
an installed Orca, run `orca/tests/orca_api_check.py` with Orca's Python
environment; it loads the extension and verifies the Orca APIs it calls.
Also run its lifecycle regression checks against the installed Orca:
```sh
GSETTINGS_BACKEND=memory python3 orca/tests/test_lifecycle.py
```
These use Orca's actual extension loader to check startup, delayed D-Bus
availability, repeated setup, disabling, and shutdown. Helper launches and
timers are mocked; the checks do not change the running reader.
Recorded presentations do not prove audible speech. For live acceptance,
open Wine Notepad with Orca running and check the window title, line,
word and character movement, selection and Backspace feedback, the File
menu, and the save dialog's buttons and message.