Provide fresh Wine review snapshots and 32-bit Edit hooks

Expose visible Wine window text to the matching Go reader's independent
keypad review commands, and extend standard Edit feedback to 32-bit programs
such as MUSHclient without requiring 32-bit Linux GLib/Winelib libraries.

Add lifetime-aware instance/window/control identities and bounded capture
of standard Edit text, button/static captions, native ListBox/ListView items,
and usable MSAA text. Preserve focus, caret, selection, scrolling, and the
clipboard. Exclude hidden/password content before retrieval, retain both
rune and UTF-16 offsets, clip visible ranges, and reject changing or
oversized sources rather than returning incomplete text as a full snapshot.

Export CaptureWindow on the version-1 WineReview D-Bus interface. Register
with the current reader service owner and publish copied focus metadata.
Authorize capture only for the current same-user owner. Use a dedicated
GLib dispatcher and separate COM worker with a 500 ms deadline, one active
job and one pending job, bounded payloads, and explicit stale/busy/limited/
unavailable replies. Keep menu and focus forwarding responsive when an MSAA
provider stalls; retain ordinary feedback with older readers.

Read the actual X11 geometry associated with Wine HWNDs using bounded XCB
queries and __wine_x11_whole_window. Translate virtual-desktop coordinates
and recheck physical geometry before returning captured text. Link XCB in
the helper/tests and declare libxcb in the Arch package dependencies.

Build edit_hook.c into the 32-bit DLL and attach both menu and input hooks
to the foreground 32-bit UI thread. Release both hooks on transitions or
attachment failure. Keep Scintilla-specific hooks confined to 64-bit builds.
Expand Edit integration checks with read-only multiline navigation and
unsuccessful deletion, plus 32-bit editor/Windows Forms lifecycle support.

Add 32-bit/64-bit native capture fixtures, wire-protocol integration checks,
and design/implementation documents. Document exact schema, capture limits,
installation dependencies, compatibility, and live acceptance procedures.

Validation during commit preparation:
- git diff --check passed.
- cmake --build build --parallel passed.
- CTest could not start because xvfb-run is unavailable in this environment.
- Further tests were skipped at the user's request; capture, protocol, and
  menu/editor integration tests were not run during commit preparation.

Live speech and physical braille checks remain necessary, including review
without moving the native caret, incoming output, plugin dialogs, and return
to Linux/Fenrir. Custom painted output requires an accessible provider;
RichEdit/Scintilla capture, semantic object review, Say All, typing echo, and
native Wine braille routing remain unsupported by this protocol.
This commit is contained in:
deedra committed 2026-10-11 20:50:56 -07:00
1 parent 872388a59b
commit a8cb350467
21 files changed
+2401 -38

No files matched your search

+60 -16
View File
@@ -24,12 +24,13 @@ Building requires an x86_64 Linux host with:
- CMake 3.20 or newer;
- Make and native GCC/G++ (the script uses CMake's default Makefile generator);
- `pkg-config` and the GLib/GIO development files;
- XCB development files for Wine-associated X11 window geometry;
- Wine development tools: `winegcc`, `wineg++`, and `widl`;
- `x86_64-w64-mingw32-gcc` and `i686-w64-mingw32-gcc` to build native menu hooks
(`mingw-w64-gcc` on Arch Linux).
The D-Bus helper is a 64-bit Winelib executable. A small 32-bit Windows
companion supplies menu hooks for 32-bit applications, without requiring
companion supplies menu and standard Edit hooks for 32-bit applications, without requiring
32-bit Linux GLib/GIO development files.
## Build
@@ -110,16 +111,17 @@ repeated selections, and restores standard-control focus reporting when menus
close. The hooks apply to the helper's Wine desktop and prefix and are removed
on normal shutdown. The 32-bit host attaches to the foreground 32-bit UI thread
so Wine's global hook chain cannot interfere with 64-bit menus. It exits when the helper dies or its bridge
window closes. Menu hooks are disabled by `--no-dialog-reader`. The 32-bit
companion handles menus; the editor subclass described below remains 64-bit.
window closes. Menu and editor hooks are disabled by `--no-dialog-reader`. The
32-bit companion attaches both hooks to the same foreground UI thread.
Focused combo boxes are checked every 100 ms to recover value changes that
Wine does not report through WinEvents. The combo's internal list events use
the same source identity as the focused combo, so the reader can accept the
new value without a Tab/Shift+Tab round trip.
The 64-bit DLL subclasses standard `Edit` controls, including Wine Notepad's
document area and `WindowsForms10.EDIT.app.*` controls. Windows Forms fields
Both hook DLLs subclass standard `Edit` controls, including Wine Notepad's
document area, MUSHclient's command field and read-only output notepad, and
`WindowsForms10.EDIT.app.*` controls. Windows Forms fields
use visible sibling labels immediately to their left, even when the labels
were created after the fields. Protected fields report their label and
password role without forwarding their contents.
@@ -130,7 +132,7 @@ contents are excluded, and read-only edits do not report unsuccessful deletions.
Undo refreshes the text snapshot used by subsequent navigation. It can attach to
an already-focused editor and resume after the helper restarts.
It also subclasses 64-bit `Scintilla` controls, including Notepad++'s document
The 64-bit DLL also subclasses `Scintilla` controls, including Notepad++'s document
area. Up/Down and page navigation report the current document line;
Left/Right report characters, and Ctrl+Left/Right report words. Focus and menu
return read the caret's line. Ordinary selections, Backspace/Delete/Ctrl+X,
@@ -163,8 +165,8 @@ so the helper queries the native control with target-architecture structures.
When a populated list has no focused or selected row, focus reads its first
row without changing selection. A bounded focus poll reports row navigation
when Wine omits selection events. Up to eight columns and 1023 UTF-16 units
per column are read. This does not add 32-bit menu or editor hooks, column
navigation, or routable object review.
per column are read. These queries do not add column navigation or routable
object review.
Native tab controls report their focused caption and position; tree controls
report the selected node and its expansion state. A bounded focus poll follows
@@ -179,25 +181,25 @@ Delphi VCL `TListView`, `TButton`, `TBitBtn`, and `TStaticText` subclasses
use these same native queries. List views with standard checkboxes report
checked/not-checked states and observe Space-key toggles even without a
selection event. This covers GoldWave 5.70's Setup list and standard buttons;
arbitrary custom Delphi controls and 32-bit menu/editor hooks remain outside
this support.
arbitrary custom Delphi controls remain outside this support.
Control values and window titles retain literal ampersands. Button and static
label captions decode keyboard mnemonics and escaped `&&`; static labels with
`SS_NOPREFIX` retain their literal text.
This is editing feedback, not a full text-review provider: Say All, review-cursor
commands and braille routing into Wine text are not implemented. Typing echo
remains the reader's responsibility. RichEdit and 32-bit editor hooks are not
These hooks provide editing feedback. Independent review-cursor commands use
the optional flat-review protocol described below; Say All and native braille
routing remain unsupported. Typing echo
remains the reader's responsibility. RichEdit and 32-bit Scintilla hooks are not
covered. Reports are limited to 1023 UTF-16 units; documents over one million
units use line feedback without full selection/deletion snapshots.
Scintilla reads at most 4096 encoded bytes per report, then limits output to
1023 UTF-16 units without splitting surrogate pairs. Wrapped Scintilla lines
report the underlying document line.
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.
Keep all five installed files together. Native menus and standard Edit controls
are supported in 32-bit and 64-bit applications; custom menus that do not send
`WM_MENUSELECT` are not covered.
## Menu integration check
@@ -207,6 +209,7 @@ available (`python-gobject` on Arch Linux):
```sh
python3 tests/menu_integration.py --build-dir build
python3 tests/menu_integration.py --build-dir build --fixture edit
python3 tests/menu_integration.py --build-dir build --fixture edit --32-bit
python3 tests/menu_integration.py --build-dir build --fixture notepad
```
@@ -226,6 +229,47 @@ application exits.
The helper source is available under the terms of LGPL-2.1-or-later. See
`LICENSE`.
## Independent Wine flat review
With the matching Go reader, existing keypad review commands read visible
standard Edit text, button/static captions, native ListBox/ListView items, and
usable MSAA captions/values in both 32-bit and 64-bit applications. Each
command captures fresh text while preserving application focus, caret,
selection, scrolling and clipboard. Password and hidden contents are excluded
before text retrieval. Caption mnemonics are decoded; literal item ampersands
are preserved. Review text uses the reader's normal speech and braille queues.
Custom painted game output still needs an accessible output provider, such as
MUSHclient's output plugin. RichEdit/Scintilla capture, semantic object review,
Say All, typing echo and native braille routing remain outside this protocol.
Protocol version 1 adds `RegisterWineReviewProvider(ou) -> b` and
`PresentWineReviewFocus(ssstssb(iiii)) -> b` to the reader service. The helper
exports `/org/stormux/Cthulhu1/WineReview`, interface
`org.stormux.Cthulhu1.WineReview`, with `CaptureWindow(sst) -> a{sv}`. Only the
current same-user reader service owner can capture. Replies contain exactly
`version:u`, `instance:s`, `window:s`, `focus:s`, `revision:t`, `status:s`,
`bounds:(iiii)`, and `nodes:aa{sv}`. Nodes have `id`, `parent`, `role`, `name`
strings; `protected`, `visible`, `text_known`, `caret_known` booleans;
`caret`, `caret_utf16` unsigned 64-bit values; `bounds:(iiii)`;
and `ranges:a(tttts(iiii))` (rune start/end, UTF-16 start/end, text, bounds).
Bounds are screen x/y/width/height. Caption text offsets remain unknown.
Older readers retain ordinary focus/menu/editor feedback.
Foreground bounds come from the X11 window associated with the HWND by
Wine's `__wine_x11_whole_window` property, using bounded XCB queries. This
handles window-manager decoration differences without title-based window
searches. Virtual-desktop child coordinates are translated to the screen;
the physical root geometry is checked again before returning text.
Capture has a 500 ms total deadline, one active and one pending job, 4096 nodes,
64 hierarchy levels, 256 ranges per control, 4096 code points per displayed
line, 65536 per control, one million native source code units, 1 MiB of text
and 2 MiB of serialized data. Non-OK replies have no nodes; stale, busy,
limited and unavailable captures never reuse cached text. Capture runs on a
separate COM worker so blocked MSAA providers do not block menu/focus events.
See [tests/README.md](tests/README.md) for checks and live acceptance.
## AI-assisted contributions
AI-assisted contributions are welcome. The person submitting a contribution