forge
Explore
Log in

Don't you dare go Hollow

srceencast: Send stream size

Browse files at this commit

05f2a3709b3447ac4d362980b166c3351a7129b2Ivan MolodetskikhParent: 743173e
Kooha requires this (even though it's optional). Unfortunately, Kooha
also seems to want memfd recording so it doesn't work anyway.
src/dbus/mutter_screen_cast.rsmodified+15 -1
@@ -7,10 +7,11 @@ use serde::Deserialize;
7 use smithay::output::Output;7 use smithay::output::Output;
8 use smithay::reexports::calloop;8 use smithay::reexports::calloop;
9 use zbus::fdo::RequestNameFlags;9 use zbus::fdo::RequestNameFlags;
10-use zbus::zvariant::{DeserializeDict, OwnedObjectPath, Type, Value};10+use zbus::zvariant::{DeserializeDict, OwnedObjectPath, SerializeDict, Type, Value};
11 use zbus::{dbus_interface, fdo, InterfaceRef, ObjectServer, SignalContext};11 use zbus::{dbus_interface, fdo, InterfaceRef, ObjectServer, SignalContext};
12 12
13 use super::Start;13 use super::Start;
14+use crate::utils::output_size;
14 15
15 #[derive(Clone)]16 #[derive(Clone)]
16 pub struct ScreenCast {17 pub struct ScreenCast {
@@ -54,6 +55,13 @@ pub struct Stream {
54 to_niri: calloop::channel::Sender<ScreenCastToNiri>,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 pub enum ScreenCastToNiri {65 pub enum ScreenCastToNiri {
58 StartCast {66 StartCast {
59 session_id: usize,67 session_id: usize,
@@ -195,6 +203,12 @@ impl Stream {
195 #[dbus_interface(signal)]203 #[dbus_interface(signal)]
196 pub async fn pipe_wire_stream_added(ctxt: &SignalContext<'_>, node_id: u32)204 pub async fn pipe_wire_stream_added(ctxt: &SignalContext<'_>, node_id: u32)
197 -> zbus::Result<()>;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 impl ScreenCast {214 impl ScreenCast {