diff --git a/src/platform/linux.rs b/src/platform/linux.rs index b2ff866c2..ce270a56c 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -374,6 +374,12 @@ pub struct WaylandDisplayInfo { pub height: i32, pub logical_size: Option<(i32, i32)>, pub refresh_rate: i32, + /// Output rotation in degrees (0/90/180/270), from `wl_output.geometry`. The mode keeps its + /// unrotated dimensions and `logical_size` arrives already swapped, so without this field a + /// rotated output is indistinguishable from a scaled one. Flipped variants map to their + /// rotation. Defaulted so a serialized snapshot from an older probe child still deserializes. + #[serde(default)] + pub transform: i32, } /// The isolated socket-probe fallback, in its own file and behind the `wayland_probe` feature so @@ -400,6 +406,20 @@ pub fn get_wayland_displays() -> ResultType> { } } +/// `wl_output::Transform` as degrees. Flipped variants report their rotation: the frame still +/// needs that turn to read upright, and a desktop compositor flipping an output without rotating +/// it is not a case any of ours can produce to test the mirror half against. +fn transform_degrees(t: sctk::reexports::client::protocol::wl_output::Transform) -> i32 { + use sctk::reexports::client::protocol::wl_output::Transform; + match t { + Transform::Normal | Transform::Flipped => 0, + Transform::_90 | Transform::Flipped90 => 90, + Transform::_180 | Transform::Flipped180 => 180, + Transform::_270 | Transform::Flipped270 => 270, + _ => 0, + } +} + fn collect_wayland_displays(conn: &Connection) -> ResultType> { struct WaylandEnv { registry_state: RegistryState, @@ -452,6 +472,7 @@ fn collect_wayland_displays(conn: &Connection) -> ResultType ResultType