forge
Explore
Log in

Don't you dare go Hollow

Redraw upon starting PW stream

Browse files at this commit

3461c66d2ce8fb53e2a709b27868229786604256Ivan MolodetskikhParent: 011c91c
Otherwise it may take a while for the first frame to arrive.
src/dbus/mutter_screen_cast.rsmodified+1 -0
@@ -64,6 +64,7 @@ pub enum ScreenCastToNiri {
64 StopCast {64 StopCast {
65 session_id: usize,65 session_id: usize,
66 },66 },
67+ Redraw(Output),
67 }68 }
68 69
69 #[dbus_interface(name = "org.gnome.Mutter.ScreenCast")]70 #[dbus_interface(name = "org.gnome.Mutter.ScreenCast")]
src/niri.rsmodified+1 -0
@@ -705,6 +705,7 @@ impl State {
705 }705 }
706 }706 }
707 ScreenCastToNiri::StopCast { session_id } => self.niri.stop_cast(session_id),707 ScreenCastToNiri::StopCast { session_id } => self.niri.stop_cast(session_id),
708+ ScreenCastToNiri::Redraw(output) => self.niri.queue_redraw(output),
708 }709 }
709 }710 }
710 711
src/pw_utils.rsmodified+11 -1
@@ -95,11 +95,20 @@ impl PipeWire {
95 ) -> anyhow::Result<Cast> {95 ) -> anyhow::Result<Cast> {
96 let _span = tracy_client::span!("PipeWire::start_cast");96 let _span = tracy_client::span!("PipeWire::start_cast");
97 97
98+ let to_niri_ = to_niri.clone();
98 let stop_cast = move || {99 let stop_cast = move || {
99- if let Err(err) = to_niri.send(ScreenCastToNiri::StopCast { session_id }) {100+ if let Err(err) = to_niri_.send(ScreenCastToNiri::StopCast { session_id }) {
100 warn!("error sending StopCast to niri: {err:?}");101 warn!("error sending StopCast to niri: {err:?}");
101 }102 }
102 };103 };
104+ let weak = output.downgrade();
105+ let redraw = move || {
106+ if let Some(output) = weak.upgrade() {
107+ if let Err(err) = to_niri.send(ScreenCastToNiri::Redraw(output)) {
108+ warn!("error sending Redraw to niri: {err:?}");
109+ }
110+ }
111+ };
103 112
104 let mode = output.current_mode().unwrap();113 let mode = output.current_mode().unwrap();
105 let size = mode.size;114 let size = mode.size;
@@ -158,6 +167,7 @@ impl PipeWire {
158 StreamState::Connecting => (),167 StreamState::Connecting => (),
159 StreamState::Streaming => {168 StreamState::Streaming => {
160 is_active.set(true);169 is_active.set(true);
170+ redraw();
161 }171 }
162 }172 }
163 }173 }