Skip to content

[Feature]: Add typed UI geometry context and correct JSON documentation #820

Closed

Description

Is your feature request related to a problem? Please describe.

Parent: #798

UIA BoundingRectangle values are physical screen pixels, while WinUI layout values are device-independent pixels (DIPs). Callers currently lack the target window's DPI context for conversion.

inspect and search already expose typed numeric element geometry, but get-property --json converts values such as BoundingRectangle and IsOffscreen to strings. Some shipped JSON documentation also says controlType even though the published element model emits type.

Describe the solution you'd like

Add explicit, additive geometry context without removing published fields:

  • On each inspect --json windows[] entry, and on the target reported by status --json, add:
    • windowDpi: the value returned by GetDpiForWindow(hwnd)
    • scale: windowDpi / 96
    • dpiAwareness: unaware, system-aware, or per-monitor-aware
    • coordinateSpace: physical-screen-pixels
  • Describe these as the window's DPI context, not unconditional monitor DPI. GetDpiForWindow returns 96 for unaware windows, system DPI for system-aware windows, and monitor DPI for per-monitor-aware windows.
  • Add a scrubbed, typed element object to get-property --json, while preserving its existing elementId and string-valued properties map.
  • Preserve existing numeric x, y, width, and height.
  • Document that 0,0,0,0 is UIA's empty/no-displayed-UI rectangle in this COM projection. Add no redundant bounds marker.
  • Keep isOffscreen independent because an offscreen element may still have nonzero bounds.
  • Keep the published type field canonical and correct documentation/examples that currently say controlType.
  • Document the actual inspect, search, wait-for, and get-property envelopes.

Additional context

Validate the contract on mixed-DPI monitors with a per-monitor-aware WinUI window and popup HWND on different monitors. Invalid HWND/DPI reads must be surfaced explicitly rather than silently defaulting to 96.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions