a7n-platform 0.19.0

Native desktop backends for the Apeirogon software KVM
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// SPDX-License-Identifier: GPL-3.0-or-later

use objc2_core_graphics::{CGDisplayBounds, CGDisplayScreenSize, CGMainDisplayID};

pub(super) fn physical_size_mm() -> Option<(u32, u32)> {
    let bounds = crate::input::macos::display_bounds().ok()?;
    let primary = CGMainDisplayID();
    let mm = CGDisplayScreenSize(primary);
    // Use the same desktop coordinate units as input, including Retina scaling.
    let pixels = CGDisplayBounds(primary).size;
    super::scale_desktop_mm(
        (mm.width, mm.height),
        (pixels.width, pixels.height),
        (f64::from(bounds.width), f64::from(bounds.height)),
    )
}