diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-29 10:13:59 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-31 23:02:38 +0400 |
| commit | 7052f0129ef5d2fa5d38eef3dbb5c9296228e341 (patch) | |
| tree | d043afb2c326a004daf3807c0a6e954d091a78f6 /src | |
| parent | 962e159db61dc6c7822aa899b1d9dc86fb6a0de5 (diff) | |
| download | niri-7052f0129ef5d2fa5d38eef3dbb5c9296228e341.tar.gz niri-7052f0129ef5d2fa5d38eef3dbb5c9296228e341.tar.bz2 niri-7052f0129ef5d2fa5d38eef3dbb5c9296228e341.zip | |
Stop screencasts on size changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/niri.rs | 11 | ||||
| -rw-r--r-- | src/pw_utils.rs | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs index 2ed62c99..424fa712 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -2434,6 +2434,7 @@ impl Niri { let scale = Scale::from(output.current_scale().fractional_scale()); let mut elements = None; + let mut casts_to_stop = vec![]; let mut casts = mem::take(&mut self.casts); for cast in &mut casts { @@ -2445,6 +2446,12 @@ impl Niri { continue; } + if cast.size != size { + debug!("stopping screencast due to output size change"); + casts_to_stop.push(cast.session_id); + continue; + } + let last = cast.last_frame_time; let min = cast.min_time_between_frames.get(); if last.is_zero() { @@ -2499,6 +2506,10 @@ impl Niri { cast.last_frame_time = target_presentation_time; } self.casts = casts; + + for id in casts_to_stop { + self.stop_cast(id); + } } #[cfg(feature = "xdp-gnome-screencast")] diff --git a/src/pw_utils.rs b/src/pw_utils.rs index 45ccc559..7ae14f61 100644 --- a/src/pw_utils.rs +++ b/src/pw_utils.rs @@ -27,6 +27,7 @@ use smithay::output::Output; use smithay::reexports::calloop::generic::Generic; use smithay::reexports::calloop::{self, Interest, LoopHandle, Mode, PostAction}; use smithay::reexports::gbm::Modifier; +use smithay::utils::{Physical, Size}; use zbus::SignalContext; use crate::dbus::mutter_screen_cast::{self, CursorMode, ScreenCastToNiri}; @@ -43,6 +44,7 @@ pub struct Cast { _listener: StreamListener<()>, pub is_active: Rc<Cell<bool>>, pub output: Output, + pub size: Size<i32, Physical>, pub cursor_mode: CursorMode, pub last_frame_time: Duration, pub min_time_between_frames: Rc<Cell<Duration>>, @@ -385,6 +387,7 @@ impl PipeWire { _listener: listener, is_active, output, + size, cursor_mode, last_frame_time: Duration::ZERO, min_time_between_frames, |
