srceencast: Send stream size
Browse files at this commit05f2a3709b3447ac4d362980b166c3351a7129b2Parent: 743173e1 changed file +15 -1
src/dbus/mutter_screen_cast.rsmodified+15 -1
| @@ -7,10 +7,11 @@ use serde::Deserialize; | ||
| 7 | 7 | use smithay::output::Output; |
| 8 | 8 | use smithay::reexports::calloop; |
| 9 | 9 | use zbus::fdo::RequestNameFlags; |
| 10 | -use zbus::zvariant::{DeserializeDict, OwnedObjectPath, Type, Value}; | |
| 10 | +use zbus::zvariant::{DeserializeDict, OwnedObjectPath, SerializeDict, Type, Value}; | |
| 11 | 11 | use zbus::{dbus_interface, fdo, InterfaceRef, ObjectServer, SignalContext}; |
| 12 | 12 | |
| 13 | 13 | use super::Start; |
| 14 | +use crate::utils::output_size; | |
| 14 | 15 | |
| 15 | 16 | #[derive(Clone)] |
| 16 | 17 | pub struct ScreenCast { |
| @@ -54,6 +55,13 @@ pub struct Stream { | ||
| 54 | 55 | to_niri: calloop::channel::Sender<ScreenCastToNiri>, |
| 55 | 56 | } |
| 56 | 57 | |
| 58 | +#[derive(Debug, SerializeDict, Type, Value)] | |
| 59 | +#[zvariant(signature = "dict")] | |
| 60 | +struct StreamParameters { | |
| 61 | + /// Size of the stream in logical coordinates. | |
| 62 | + size: (i32, i32), | |
| 63 | +} | |
| 64 | + | |
| 57 | 65 | pub enum ScreenCastToNiri { |
| 58 | 66 | StartCast { |
| 59 | 67 | session_id: usize, |
| @@ -195,6 +203,12 @@ impl Stream { | ||
| 195 | 203 | #[dbus_interface(signal)] |
| 196 | 204 | pub async fn pipe_wire_stream_added(ctxt: &SignalContext<'_>, node_id: u32) |
| 197 | 205 | -> zbus::Result<()>; |
| 206 | + | |
| 207 | + #[dbus_interface(property)] | |
| 208 | + async fn parameters(&self) -> StreamParameters { | |
| 209 | + let size = output_size(&self.output).into(); | |
| 210 | + StreamParameters { size } | |
| 211 | + } | |
| 198 | 212 | } |
| 199 | 213 | |
| 200 | 214 | impl ScreenCast { |