Skip to main content

scale_corrected_rect

Function scale_corrected_rect 

Source
fn scale_corrected_rect(
    rect: MonitorRect,
    scale: f64,
    wayland: bool,
) -> MonitorRect
Expand description

Correct a monitor’s reported geometry for the GNOME/Wayland HiDPI quirk where tao returns monitor.size() and position() already multiplied by the scale factor. Feeding those straight into set_size/set_position (which divide by the window’s scale factor again) builds an overlay scale× too large in each axis — it spills onto the neighbouring monitor and pushes the hint and Skip controls off the bottom of the screen (#67, Steffi’s 2×4K @ 200% report). On Wayland with a >1 scale we divide back out to the true physical geometry; on X11 and macOS monitor.size() is already true physical, so it’s a no-op. Pure so the correction is unit-testable without a windowing system.

Assumes a uniform scale across monitors: each rect’s position is divided by that monitor’s own scale, which only stays globally coherent when every monitor shares one factor (the common case). A mixed-DPI Wayland layout would need a shared coordinate basis — not handled here, since the whole correction is a workaround for the tao reporting quirk rather than a general geometry layer.