libwayshot_xcap/
output.rs1use std::fmt::Display;
2
3use wayland_client::protocol::{wl_output, wl_output::WlOutput};
4
5use crate::region::{LogicalRegion, Size};
6
7#[derive(Debug, Clone, PartialEq, Eq, Hash)]
11pub struct OutputInfo {
12 pub wl_output: WlOutput,
13 pub name: String,
14 pub description: String,
15 pub transform: wl_output::Transform,
16 pub physical_size: Size,
17 pub logical_region: LogicalRegion,
18}
19
20impl Display for OutputInfo {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 write!(
23 f,
24 "{name} ({description})",
25 name = self.name,
26 description = self.description
27 )
28 }
29}
30
31impl OutputInfo {
32 pub(crate) fn scale(&self) -> f64 {
33 self.physical_size.height as f64 / self.logical_region.inner.size.height as f64
34 }
35}