Rename ToNiriMsg to ScreenCastToNiri

This commit is contained in:
Ivan Molodetskikh
2023-10-10 08:55:54 +04:00
parent a0b8da69c7
commit d66bd87c66
3 changed files with 18 additions and 18 deletions
+10 -10
View File
@@ -12,7 +12,7 @@ use zbus::{dbus_interface, fdo, InterfaceRef, ObjectServer, SignalContext};
#[derive(Clone)] #[derive(Clone)]
pub struct ScreenCast { pub struct ScreenCast {
connectors: Arc<Mutex<HashMap<String, Output>>>, connectors: Arc<Mutex<HashMap<String, Output>>>,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
sessions: Arc<Mutex<Vec<(Session, InterfaceRef<Session>)>>>, sessions: Arc<Mutex<Vec<(Session, InterfaceRef<Session>)>>>,
} }
@@ -20,7 +20,7 @@ pub struct ScreenCast {
pub struct Session { pub struct Session {
id: usize, id: usize,
connectors: Arc<Mutex<HashMap<String, Output>>>, connectors: Arc<Mutex<HashMap<String, Output>>>,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
streams: Arc<Mutex<Vec<(Stream, InterfaceRef<Stream>)>>>, streams: Arc<Mutex<Vec<(Stream, InterfaceRef<Stream>)>>>,
} }
@@ -46,10 +46,10 @@ pub struct Stream {
output: Output, output: Output,
cursor_mode: CursorMode, cursor_mode: CursorMode,
was_started: Arc<AtomicBool>, was_started: Arc<AtomicBool>,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
} }
pub enum ToNiriMsg { pub enum ScreenCastToNiri {
StartCast { StartCast {
session_id: usize, session_id: usize,
output: Output, output: Output,
@@ -121,7 +121,7 @@ impl Session {
Session::closed(&ctxt).await.unwrap(); Session::closed(&ctxt).await.unwrap();
if let Err(err) = self.to_niri.send(ToNiriMsg::StopCast { if let Err(err) = self.to_niri.send(ScreenCastToNiri::StopCast {
session_id: self.id, session_id: self.id,
}) { }) {
warn!("error sending StopCast to niri: {err:?}"); warn!("error sending StopCast to niri: {err:?}");
@@ -190,7 +190,7 @@ impl Stream {
impl ScreenCast { impl ScreenCast {
pub fn new( pub fn new(
connectors: Arc<Mutex<HashMap<String, Output>>>, connectors: Arc<Mutex<HashMap<String, Output>>>,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
) -> Self { ) -> Self {
Self { Self {
connectors, connectors,
@@ -204,7 +204,7 @@ impl Session {
pub fn new( pub fn new(
id: usize, id: usize,
connectors: Arc<Mutex<HashMap<String, Output>>>, connectors: Arc<Mutex<HashMap<String, Output>>>,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
) -> Self { ) -> Self {
Self { Self {
id, id,
@@ -217,7 +217,7 @@ impl Session {
impl Drop for Session { impl Drop for Session {
fn drop(&mut self) { fn drop(&mut self) {
let _ = self.to_niri.send(ToNiriMsg::StopCast { let _ = self.to_niri.send(ScreenCastToNiri::StopCast {
session_id: self.id, session_id: self.id,
}); });
} }
@@ -227,7 +227,7 @@ impl Stream {
pub fn new( pub fn new(
output: Output, output: Output,
cursor_mode: CursorMode, cursor_mode: CursorMode,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
) -> Self { ) -> Self {
Self { Self {
output, output,
@@ -242,7 +242,7 @@ impl Stream {
return; return;
} }
let msg = ToNiriMsg::StartCast { let msg = ScreenCastToNiri::StartCast {
session_id, session_id,
output: self.output.clone(), output: self.output.clone(),
cursor_mode: self.cursor_mode, cursor_mode: self.cursor_mode,
+5 -5
View File
@@ -78,7 +78,7 @@ use crate::cursor::Cursor;
use crate::dbus::gnome_shell_screenshot::{self, NiriToScreenshot, ScreenshotToNiri}; use crate::dbus::gnome_shell_screenshot::{self, NiriToScreenshot, ScreenshotToNiri};
use crate::dbus::mutter_display_config::DisplayConfig; use crate::dbus::mutter_display_config::DisplayConfig;
#[cfg(feature = "xdp-gnome-screencast")] #[cfg(feature = "xdp-gnome-screencast")]
use crate::dbus::mutter_screen_cast::{self, ScreenCast, ToNiriMsg}; use crate::dbus::mutter_screen_cast::{self, ScreenCast, ScreenCastToNiri};
use crate::dbus::mutter_service_channel::ServiceChannel; use crate::dbus::mutter_service_channel::ServiceChannel;
use crate::frame_clock::FrameClock; use crate::frame_clock::FrameClock;
use crate::layout::{output_size, Layout, MonitorRenderElement}; use crate::layout::{output_size, Layout, MonitorRenderElement};
@@ -310,11 +310,11 @@ impl State {
#[cfg(feature = "xdp-gnome-screencast")] #[cfg(feature = "xdp-gnome-screencast")]
fn on_screen_cast_msg( fn on_screen_cast_msg(
&mut self, &mut self,
to_niri: &calloop::channel::Sender<ToNiriMsg>, to_niri: &calloop::channel::Sender<ScreenCastToNiri>,
msg: ToNiriMsg, msg: ScreenCastToNiri,
) { ) {
match msg { match msg {
ToNiriMsg::StartCast { ScreenCastToNiri::StartCast {
session_id, session_id,
output, output,
cursor_mode, cursor_mode,
@@ -350,7 +350,7 @@ impl State {
} }
} }
} }
ToNiriMsg::StopCast { session_id } => self.niri.stop_cast(session_id), ScreenCastToNiri::StopCast { session_id } => self.niri.stop_cast(session_id),
} }
} }
+3 -3
View File
@@ -29,7 +29,7 @@ use smithay::reexports::calloop::{self, Interest, LoopHandle, Mode, PostAction};
use smithay::reexports::gbm::Modifier; use smithay::reexports::gbm::Modifier;
use zbus::SignalContext; use zbus::SignalContext;
use crate::dbus::mutter_screen_cast::{self, CursorMode, ToNiriMsg}; use crate::dbus::mutter_screen_cast::{self, CursorMode, ScreenCastToNiri};
use crate::niri::State; use crate::niri::State;
pub struct PipeWire { pub struct PipeWire {
@@ -86,7 +86,7 @@ impl PipeWire {
pub fn start_cast( pub fn start_cast(
&self, &self,
to_niri: calloop::channel::Sender<ToNiriMsg>, to_niri: calloop::channel::Sender<ScreenCastToNiri>,
gbm: GbmDevice<DrmDeviceFd>, gbm: GbmDevice<DrmDeviceFd>,
session_id: usize, session_id: usize,
output: Output, output: Output,
@@ -96,7 +96,7 @@ impl PipeWire {
let _span = tracy_client::span!("PipeWire::start_cast"); let _span = tracy_client::span!("PipeWire::start_cast");
let stop_cast = move || { let stop_cast = move || {
if let Err(err) = to_niri.send(ToNiriMsg::StopCast { session_id }) { if let Err(err) = to_niri.send(ScreenCastToNiri::StopCast { session_id }) {
warn!("error sending StopCast to niri: {err:?}"); warn!("error sending StopCast to niri: {err:?}");
} }
}; };