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.
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#pragma once
|
|
#include <windows.h>
|
|
#include <cstdint>
|
|
#include <mutex>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
struct ReviewFocus {
|
|
std::string instance, window, focus, title, role;
|
|
uint64_t revision = 0;
|
|
bool protected_text = false;
|
|
RECT bounds{};
|
|
};
|
|
struct ReviewRange {
|
|
uint64_t start = 0, end = 0, utf16_start = 0, utf16_end = 0;
|
|
std::string text;
|
|
RECT bounds{};
|
|
};
|
|
struct ReviewNode {
|
|
std::string id, parent, role, name;
|
|
bool protected_text = false, visible = true, text_known = false, caret_known = false;
|
|
uint64_t caret = 0, caret_utf16 = 0;
|
|
RECT bounds{};
|
|
std::vector<ReviewRange> ranges;
|
|
};
|
|
struct ReviewCapture {
|
|
ReviewFocus source;
|
|
std::string status = "unavailable";
|
|
std::vector<ReviewNode> nodes;
|
|
};
|
|
|
|
// No native references are retained here. The event and capture STAs share
|
|
// only lifetime tokens, protected by this mutex.
|
|
class ReviewIdentityStore {
|
|
public:
|
|
ReviewIdentityStore();
|
|
ReviewFocus observe_foreground();
|
|
void destroyed(HWND, LONG object, LONG child);
|
|
void reordered(HWND, LONG object);
|
|
void retire();
|
|
std::string identity(HWND);
|
|
private:
|
|
struct State {
|
|
std::mutex mutex;
|
|
std::unordered_map<HWND, std::string> identities;
|
|
std::string instance, window, focus;
|
|
uint64_t next = 0, revision = 0;
|
|
};
|
|
// A detached stalled COM worker can retain this state safely until process
|
|
// shutdown; it never borrows the event thread's stack or native references.
|
|
std::shared_ptr<State> state_;
|
|
};
|
|
|
|
ReviewCapture capture_review_window(ReviewIdentityStore&, const ReviewFocus&,
|
|
uint64_t deadline_tick);
|