|
| 1 | +Window Client-Area Geometry |
| 2 | +=========================== |
| 3 | + |
| 4 | +``window_capture.get_window_geometry`` returns a window's *outer* bounding box (for |
| 5 | +screenshotting), but there is no *client*-area rect, no frame-inset math, and no |
| 6 | +client→screen point mapping. RPA needs "click at ``(x, y)`` *inside* this window's |
| 7 | +client area regardless of title-bar height / borders" — the building block for |
| 8 | +window-relative clicking. This adds the client rect, the pure frame-inset and |
| 9 | +client-to-screen helpers, and a one-call ``client_point``. |
| 10 | + |
| 11 | +``frame_insets`` / ``client_to_screen`` are pure geometry (headless-testable); only |
| 12 | +``get_client_rect``'s default reader touches Win32 (``GetClientRect`` + |
| 13 | +``ClientToScreen``), and it is injectable. Imports no ``PySide6``. |
| 14 | + |
| 15 | +Headless API |
| 16 | +------------ |
| 17 | + |
| 18 | +.. code-block:: python |
| 19 | +
|
| 20 | + from je_auto_control import (get_client_rect, client_point, frame_insets, |
| 21 | + client_to_screen) |
| 22 | +
|
| 23 | + # Click 20px in, 30px down from the window's content origin (not its title bar). |
| 24 | + point = client_point("Calculator", 20, 30) |
| 25 | + if point: |
| 26 | + click(*point) |
| 27 | +
|
| 28 | + rect = get_client_rect("Calculator") # (x, y, width, height) |
| 29 | + insets = frame_insets(get_window_geometry("Calculator"), rect) # border sizes |
| 30 | +
|
| 31 | +``get_client_rect`` returns the client area as ``(x, y, width, height)`` with a |
| 32 | +screen-coordinate origin (or ``None``); ``client_point`` maps a client-local point to |
| 33 | +the screen so a click lands inside the content regardless of chrome. ``frame_insets`` |
| 34 | +returns the ``{left, top, right, bottom}`` border/title-bar thickness from the outer |
| 35 | +and client rects, and ``client_to_screen`` is the underlying pure offset. |
| 36 | + |
| 37 | +Executor commands |
| 38 | +----------------- |
| 39 | + |
| 40 | +``AC_get_client_rect`` (``title`` → ``{found, rect}``) and ``AC_client_point`` |
| 41 | +(``title`` / ``x`` / ``y`` → ``{found, point}``). They are exposed as the MCP tools |
| 42 | +``ac_get_client_rect`` / ``ac_client_point`` and as Script Builder commands under |
| 43 | +**Window**. |
0 commit comments