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 {
6464 StopCast {
6565 session_id: usize,
6666 },
67+ Redraw(Output),
6768 }
6869
6970 #[dbus_interface(name = "org.gnome.Mutter.ScreenCast")]
src/niri.rsmodified+1 -0
@@ -705,6 +705,7 @@ impl State {
705705 }
706706 }
707707 ScreenCastToNiri::StopCast { session_id } => self.niri.stop_cast(session_id),
708+ ScreenCastToNiri::Redraw(output) => self.niri.queue_redraw(output),
708709 }
709710 }
710711
src/pw_utils.rsmodified+11 -1
@@ -95,11 +95,20 @@ impl PipeWire {
9595 ) -> anyhow::Result<Cast> {
9696 let _span = tracy_client::span!("PipeWire::start_cast");
9797
98+ let to_niri_ = to_niri.clone();
9899 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 }) {
100101 warn!("error sending StopCast to niri: {err:?}");
101102 }
102103 };
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+ };
103112
104113 let mode = output.current_mode().unwrap();
105114 let size = mode.size;
@@ -158,6 +167,7 @@ impl PipeWire {
158167 StreamState::Connecting => (),
159168 StreamState::Streaming => {
160169 is_active.set(true);
170+ redraw();
161171 }
162172 }
163173 }