diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-18 21:16:36 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-18 21:16:36 +0400 |
| commit | 3461c66d2ce8fb53e2a709b27868229786604256 (patch) | |
| tree | 4e0a7b99042c307eb96aa3c8a9c884ccce918797 /src/pw_utils.rs | |
| parent | 011c91c98a76880744d35afa763c20db074d9c90 (diff) | |
| download | niri-3461c66d2ce8fb53e2a709b27868229786604256.tar.gz niri-3461c66d2ce8fb53e2a709b27868229786604256.tar.bz2 niri-3461c66d2ce8fb53e2a709b27868229786604256.zip | |
Redraw upon starting PW stream
Otherwise it may take a while for the first frame to arrive.
Diffstat (limited to 'src/pw_utils.rs')
| -rw-r--r-- | src/pw_utils.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pw_utils.rs b/src/pw_utils.rs index 7a85a7a2..097cfdd7 100644 --- a/src/pw_utils.rs +++ b/src/pw_utils.rs @@ -95,11 +95,20 @@ impl PipeWire { ) -> anyhow::Result<Cast> { let _span = tracy_client::span!("PipeWire::start_cast"); + let to_niri_ = to_niri.clone(); let stop_cast = move || { - if let Err(err) = to_niri.send(ScreenCastToNiri::StopCast { session_id }) { + if let Err(err) = to_niri_.send(ScreenCastToNiri::StopCast { session_id }) { warn!("error sending StopCast to niri: {err:?}"); } }; + let weak = output.downgrade(); + let redraw = move || { + if let Some(output) = weak.upgrade() { + if let Err(err) = to_niri.send(ScreenCastToNiri::Redraw(output)) { + warn!("error sending Redraw to niri: {err:?}"); + } + } + }; let mode = output.current_mode().unwrap(); let size = mode.size; @@ -158,6 +167,7 @@ impl PipeWire { StreamState::Connecting => (), StreamState::Streaming => { is_active.set(true); + redraw(); } } } |
