Skip to main content

Module convert

Module convert 

Source
Expand description

Coordinate-space conversion — the part most tools get wrong.

A pixelcoords session records physical pixels plus each monitor’s DPI scale. Input APIs disagree about what they want:

PlatformInput API speaks
macOS (CGEvent)logical points, global space, origin top-left
Windows (SendInput)physical pixels, normalized across the virtual desktop
Linux/X11 (XTEST)physical pixels on the root window

So the same saved coordinate needs a different conversion per platform. Getting this wrong doesn’t error — it clicks the wrong place, which is why the conversion lives here, alone, and is property-tested.

Structs§

ResolvedPoint
A point in a named space, carrying the monitor it was resolved against so a caller can report — or re-derive — the conversion.

Enums§

Space
The coordinate space a consumer wants a point in.

Functions§

corners
Every monitor’s four corners, converted into space.
monitor_at
Which monitor contains a global physical point.
native_space
The space Space::Auto resolves to on the platform this was compiled for. Stated once — and not here.
near_screen_corner
Whether a point already expressed in space sits within margin of any monitor’s corner.
to_space
Convert a global physical point into space, using the scale of the monitor that contains it.