feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)
This commit is contained in:
parent
f49acf0105
commit
10af20a0ad
157 changed files with 29455 additions and 913 deletions
|
|
@ -250,7 +250,11 @@ def _caret_rect_and_offset(auto: Any, control: Any) -> tuple[Optional[dict], Opt
|
|||
|
||||
|
||||
|
||||
def _wake_chromium_accessibility() -> bool:
|
||||
_woken_hwnds: dict[int, float] = {}
|
||||
_WAKE_TTL_SECONDS = 60.0
|
||||
|
||||
|
||||
def _wake_chromium_accessibility(force: bool = False) -> bool:
|
||||
"""Chromium 계열에 "보조기술이 있다" 고 알려 접근성 트리를 열게 한다.
|
||||
|
||||
Chromium 문서: 브라우저가 EVENT_SYSTEM_ALERT + custom object id 1 을 알리고,
|
||||
|
|
@ -259,6 +263,7 @@ def _wake_chromium_accessibility() -> bool:
|
|||
LegacyIAccessible 만 노출돼 텍스트를 읽을 수 없다(실측: edit=false src=legacy len=0).
|
||||
|
||||
SendMessage 대신 SendMessageTimeout 을 쓰는 이유: 대상이 바쁘면 무한 대기한다.
|
||||
이미 깨운 HWND 는 _WAKE_TTL_SECONDS 동안 재전송하지 않아 타이핑 중 대상 창 UI 스레드 지연을 막는다.
|
||||
"""
|
||||
try:
|
||||
import ctypes # noqa: PLC0415
|
||||
|
|
@ -268,10 +273,19 @@ def _wake_chromium_accessibility() -> bool:
|
|||
WM_GETOBJECT = 0x003D
|
||||
OBJID_CLIENT = 0xFFFFFFFC
|
||||
|
||||
hwnd = user32.GetForegroundWindow()
|
||||
hwnd = int(user32.GetForegroundWindow() or 0)
|
||||
if not hwnd:
|
||||
return False
|
||||
|
||||
now = time.monotonic()
|
||||
last_woken = _woken_hwnds.get(hwnd)
|
||||
if not force and last_woken is not None and (now - last_woken) < _WAKE_TTL_SECONDS:
|
||||
return True
|
||||
|
||||
if len(_woken_hwnds) > 128:
|
||||
_woken_hwnds.clear()
|
||||
_woken_hwnds[hwnd] = now
|
||||
|
||||
result = ctypes.c_void_p()
|
||||
# 1 = 보조기술 감지용 custom object id
|
||||
user32.SendMessageTimeoutW(
|
||||
|
|
@ -280,7 +294,7 @@ def _wake_chromium_accessibility() -> bool:
|
|||
wintypes.WPARAM(0),
|
||||
wintypes.LPARAM(1),
|
||||
0x0002, # SMTO_ABORTIFHUNG
|
||||
250,
|
||||
120,
|
||||
ctypes.byref(result),
|
||||
)
|
||||
# 클라이언트 영역 객체도 함께 요청해 AX 트리를 확실히 깨운다.
|
||||
|
|
@ -290,7 +304,7 @@ def _wake_chromium_accessibility() -> bool:
|
|||
wintypes.WPARAM(0),
|
||||
wintypes.LPARAM(OBJID_CLIENT & 0xFFFFFFFF),
|
||||
0x0002,
|
||||
250,
|
||||
120,
|
||||
ctypes.byref(result),
|
||||
)
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue