aboutsummaryrefslogtreecommitdiff
path: root/niri-ipc/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-27 14:54:24 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-27 14:54:24 +0400
commitcf87a185a90aeacf7c15d27ddba23bc493d9c2dd (patch)
treee8625c61105821b8d552db86f70839b1282151b4 /niri-ipc/src
parente276c906bf4bea27dc8173815ff373d04c20caaf (diff)
downloadniri-cf87a185a90aeacf7c15d27ddba23bc493d9c2dd.tar.gz
niri-cf87a185a90aeacf7c15d27ddba23bc493d9c2dd.tar.bz2
niri-cf87a185a90aeacf7c15d27ddba23bc493d9c2dd.zip
Add logical output info and preferred modes to IPC
Diffstat (limited to 'niri-ipc/src')
-rw-r--r--niri-ipc/src/lib.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs
index a6f8a284..34a626a6 100644
--- a/niri-ipc/src/lib.rs
+++ b/niri-ipc/src/lib.rs
@@ -248,6 +248,10 @@ pub struct Output {
///
/// `None` if the output is disabled.
pub current_mode: Option<usize>,
+ /// Logical output information.
+ ///
+ /// `None` if the output is not mapped to any logical output (for example, if it is disabled).
+ pub logical: Option<LogicalOutput>,
}
/// Output mode.
@@ -259,6 +263,49 @@ pub struct Mode {
pub height: u16,
/// Refresh rate in millihertz.
pub refresh_rate: u32,
+ /// Whether this mode is preferred by the monitor.
+ pub is_preferred: bool,
+}
+
+/// Logical output in the compositor's coordinate space.
+#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
+pub struct LogicalOutput {
+ /// Logical X position.
+ pub x: i32,
+ /// Logical Y position.
+ pub y: i32,
+ /// Width in logical pixels.
+ pub width: u32,
+ /// Height in logical pixels.
+ pub height: u32,
+ /// Scale factor.
+ pub scale: f64,
+ /// Transform.
+ pub transform: Transform,
+}
+
+/// Output transform, which goes counter-clockwise.
+#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
+pub enum Transform {
+ /// Untransformed.
+ Normal,
+ /// Rotated by 90°.
+ #[serde(rename = "90")]
+ _90,
+ /// Rotated by 180°.
+ #[serde(rename = "180")]
+ _180,
+ /// Rotated by 270°.
+ #[serde(rename = "270")]
+ _270,
+ /// Flipped horizontally.
+ Flipped,
+ /// Rotated by 90° and flipped horizontally.
+ Flipped90,
+ /// Flipped vertically.
+ Flipped180,
+ /// Rotated by 270° and flipped horizontally.
+ Flipped270,
}
impl FromStr for SizeChange {