First pass at handling menus in wine.

This commit is contained in:
Storm Dragon committed 2026-10-09 15:45:18 -04:00
1 parent cc6523e6fd
commit 0992ffee0d
9 files changed
+520 -18

No files matched your search

+31 -1
View File
@@ -23,7 +23,9 @@ Building requires an x86_64 Linux host with:
- CMake 3.20 or newer;
- `pkg-config` and the GLib/GIO development files;
- Wine development tools: `winegcc`, `wineg++`, and `widl`.
- Wine development tools: `winegcc`, `wineg++`, and `widl`;
- `x86_64-w64-mingw32-gcc` to build the native menu hook DLL
(`mingw-w64-gcc` on Arch Linux).
The target is a Winelib executable. A 32-bit build is not provided by this
project yet; it needs a 32-bit Winegcc and 32-bit GLib/GIO development setup.
@@ -50,6 +52,7 @@ That installs the helper and its Winelib sidecar as:
```text
$prefix/libexec/cthulhu/wine/cthulhu-wine-access.exe
$prefix/libexec/cthulhu/wine/cthulhu-wine-access.exe.so
$prefix/libexec/cthulhu/wine/wine-access-menu.dll
```
For Cthulhu-Go, either set `CTHULHU_WINE_ACCESS_HELPER` to the installed
@@ -76,6 +79,33 @@ The standard-control reader is deliberately limited to native Wine controls.
Custom-drawn, DirectX, and game-specific accessibility APIs remain the
responsibility of the application or its accessibility middleware.
Native menu reading uses an accompanying 64-bit Windows hook DLL. It observes
`WM_MENUSELECT` inside Wine applications and sends menu labels, displayed
shortcuts, submenu roles, and checked/unavailable states to the helper. The
helper queues these messages before forwarding them over D-Bus, suppresses
repeated selections, and restores standard-control focus reporting when menus
close. The hook applies to the helper's Wine desktop and prefix and is removed
on normal shutdown. It is disabled by `--no-dialog-reader`.
Keep all three installed files together. The native hook currently targets
64-bit applications; 32-bit menu coverage and custom menus that do not send
`WM_MENUSELECT` are not established.
## Menu integration check
After building, run this in a graphical session with Python's PyGObject
available (`python-gobject` on Arch Linux):
```sh
python3 tests/menu_integration.py --build-dir build
```
The test opens a short-lived native menu window in a temporary Wine prefix,
uses a private D-Bus recording service, and checks keyboard menu navigation,
context menus, shortcuts, item states, and duplicate suppression. It does not
send speech or braille to the running reader. Live listening with Cthulhu is a
separate acceptance check.
## License
The helper source is available under the terms of LGPL-2.1-or-later. See