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

+32 -5
View File
@@ -6,6 +6,7 @@ set(WINE_ACCESS_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR}/cthulhu/wine" CACHE PAT
"Installation directory for the Wine helper and its Winelib sidecar")
find_package(PkgConfig REQUIRED)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb)
find_program(WIDL_EXECUTABLE widl REQUIRED)
find_program(MINGW_C_COMPILER x86_64-w64-mingw32-gcc REQUIRED)
find_program(MINGW32_C_COMPILER i686-w64-mingw32-gcc REQUIRED)
@@ -26,12 +27,13 @@ set(menu_hook32 "${CMAKE_CURRENT_BINARY_DIR}/wine-access-menu32.dll")
set(menu_host32 "${CMAKE_CURRENT_BINARY_DIR}/wine-access-menu-host32.exe")
add_custom_command(OUTPUT "${menu_hook32}" "${menu_host32}"
COMMAND "${MINGW32_C_COMPILER}" -std=c11 -O2 -Wall -Wextra -shared
-static-libgcc -Wl,--kill-at -DWINE_ACCESS_MENU_ONLY -o "${menu_hook32}"
"${CMAKE_CURRENT_SOURCE_DIR}/menu_hook.c" -luser32
-static-libgcc -Wl,--kill-at -o "${menu_hook32}"
"${CMAKE_CURRENT_SOURCE_DIR}/menu_hook.c"
"${CMAKE_CURRENT_SOURCE_DIR}/edit_hook.c" -luser32 -lcomctl32
COMMAND "${MINGW32_C_COMPILER}" -std=c11 -O2 -Wall -Wextra -mwindows
-static-libgcc -o "${menu_host32}"
"${CMAKE_CURRENT_SOURCE_DIR}/menu_host32.c" -luser32
DEPENDS menu_hook.c menu_bridge.h menu_host32.c
DEPENDS menu_hook.c menu_bridge.h menu_host32.c edit_hook.c edit_hook.h control_class.h
VERBATIM)
add_custom_target(wine-access-menu32 ALL DEPENDS "${menu_hook32}" "${menu_host32}")
@@ -47,12 +49,12 @@ add_custom_command(
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/nvdaController.idl"
VERBATIM)
add_executable(cthulhu-wine-access main.cpp list_view.cpp native_items.cpp "${generated_server}")
add_executable(cthulhu-wine-access main.cpp list_view.cpp native_items.cpp review_capture.cpp review_x11.cpp review_service.cpp "${generated_server}")
add_dependencies(cthulhu-wine-access wine-access-menu wine-access-menu32)
target_compile_features(cthulhu-wine-access PRIVATE cxx_std_20)
target_include_directories(cthulhu-wine-access PRIVATE "${generated_dir}")
target_link_libraries(cthulhu-wine-access PRIVATE
PkgConfig::GIO oleacc ole32 oleaut32 rpcrt4 user32)
PkgConfig::GIO PkgConfig::XCB oleacc ole32 oleaut32 rpcrt4 user32 gdi32)
target_link_options(cthulhu-wine-access PRIVATE -mwindows)
target_compile_options(cthulhu-wine-access PRIVATE
$<$<COMPILE_LANGUAGE:C,CXX>:-Wall -Wextra>)
@@ -65,6 +67,31 @@ if(BUILD_TESTING)
add_test(NAME msaa-states COMMAND "${CMAKE_CURRENT_BINARY_DIR}/msaa-states-test.exe")
set_tests_properties(msaa-states PROPERTIES ENVIRONMENT
"WINEPREFIX=${CMAKE_CURRENT_BINARY_DIR}/test-prefix;CTHULHU_WINE_ACCESS_MANAGED=1;WINEDEBUG=-all;WINEDLLOVERRIDES=mscoree,mshtml=")
add_executable(review-capture-test tests/review_capture_test.cpp)
target_compile_features(review-capture-test PRIVATE cxx_std_20)
target_compile_options(review-capture-test PRIVATE -Wall -Wextra)
target_link_libraries(review-capture-test PRIVATE ole32 oleacc oleaut32 user32 gdi32 PkgConfig::GIO PkgConfig::XCB)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/review_capture.cpp")
target_sources(review-capture-test PRIVATE review_capture.cpp review_x11.cpp list_view.cpp native_items.cpp)
endif()
foreach(arch IN ITEMS 64 32)
if(arch EQUAL 32)
set(fixture_compiler "${MINGW32_C_COMPILER}")
else()
set(fixture_compiler "${MINGW_C_COMPILER}")
endif()
set(review_fixture "${CMAKE_CURRENT_BINARY_DIR}/review-fixture${arch}.exe")
add_custom_command(OUTPUT "${review_fixture}"
COMMAND "${fixture_compiler}" -std=c11 -Wall -Wextra -mwindows
-o "${review_fixture}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/review_fixture.c" -luser32 -lcomctl32
DEPENDS tests/review_fixture.c VERBATIM)
add_custom_target(review-fixture${arch} ALL DEPENDS "${review_fixture}")
add_dependencies(review-capture-test review-fixture${arch})
add_test(NAME review-capture${arch}
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/review-capture-test.exe" --fixture "${review_fixture}")
set_tests_properties(review-capture${arch} PROPERTIES TIMEOUT 35 ENVIRONMENT
"WINEPREFIX=${CMAKE_CURRENT_BINARY_DIR}/review-prefix${arch};CTHULHU_WINE_ACCESS_MANAGED=1;WINEDEBUG=-all;WINEDLLOVERRIDES=mscoree,mshtml=")
endforeach()
endif()
# Winegcc emits a launcher and a Winelib sidecar. CMake's normal target