mirror of
https://github.com/YaLTeR/niri.git
synced 2024-09-11 12:35:58 +03:00
Rename connectors to enabled_outputs
This commit is contained in:
parent
f068157f55
commit
768b326028
@ -111,10 +111,10 @@ impl Backend {
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "dbus"), allow(unused))]
|
||||
pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
|
||||
pub fn enabled_outputs(&self) -> Arc<Mutex<HashMap<String, Output>>> {
|
||||
match self {
|
||||
Backend::Tty(tty) => tty.connectors(),
|
||||
Backend::Winit(winit) => winit.connectors(),
|
||||
Backend::Tty(tty) => tty.enabled_outputs(),
|
||||
Backend::Winit(winit) => winit.enabled_outputs(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ pub struct Tty {
|
||||
// The allocator for the primary GPU. It is only `Some()` if we have a device corresponding to
|
||||
// the primary GPU.
|
||||
primary_allocator: Option<DmabufAllocator<GbmAllocator<DrmDeviceFd>>>,
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
}
|
||||
|
||||
pub type TtyRenderer<'render, 'alloc> = MultiRenderer<
|
||||
@ -221,7 +221,7 @@ impl Tty {
|
||||
devices: HashMap::new(),
|
||||
dmabuf_global: None,
|
||||
primary_allocator: None,
|
||||
connectors: Arc::new(Mutex::new(HashMap::new())),
|
||||
enabled_outputs: Arc::new(Mutex::new(HashMap::new())),
|
||||
}
|
||||
}
|
||||
|
||||
@ -736,7 +736,7 @@ impl Tty {
|
||||
let sequence_delta_plot_name =
|
||||
tracy_client::PlotName::new_leak(format!("{output_name} sequence delta"));
|
||||
|
||||
self.connectors
|
||||
self.enabled_outputs
|
||||
.lock()
|
||||
.unwrap()
|
||||
.insert(output_name.clone(), output.clone());
|
||||
@ -794,7 +794,7 @@ impl Tty {
|
||||
error!("missing output for crtc {crtc:?}");
|
||||
};
|
||||
|
||||
self.connectors.lock().unwrap().remove(&surface.name);
|
||||
self.enabled_outputs.lock().unwrap().remove(&surface.name);
|
||||
}
|
||||
|
||||
fn on_vblank(
|
||||
@ -1157,8 +1157,8 @@ impl Tty {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
|
||||
self.connectors.clone()
|
||||
pub fn enabled_outputs(&self) -> Arc<Mutex<HashMap<String, Output>>> {
|
||||
self.enabled_outputs.clone()
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
|
@ -28,7 +28,7 @@ pub struct Winit {
|
||||
output: Output,
|
||||
backend: WinitGraphicsBackend<GlesRenderer>,
|
||||
damage_tracker: OutputDamageTracker,
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
}
|
||||
|
||||
impl Winit {
|
||||
@ -56,7 +56,7 @@ impl Winit {
|
||||
output.change_current_state(Some(mode), Some(Transform::Flipped180), None, None);
|
||||
output.set_preferred(mode);
|
||||
|
||||
let connectors = Arc::new(Mutex::new(HashMap::from([(
|
||||
let enabled_outputs = Arc::new(Mutex::new(HashMap::from([(
|
||||
"winit".to_owned(),
|
||||
output.clone(),
|
||||
)])));
|
||||
@ -95,7 +95,7 @@ impl Winit {
|
||||
output,
|
||||
backend,
|
||||
damage_tracker,
|
||||
connectors,
|
||||
enabled_outputs,
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ impl Winit {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
|
||||
self.connectors.clone()
|
||||
pub fn enabled_outputs(&self) -> Arc<Mutex<HashMap<String, Output>>> {
|
||||
self.enabled_outputs.clone()
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ impl DBusServers {
|
||||
}
|
||||
|
||||
if is_session_instance || config.debug.dbus_interfaces_in_non_session_instances {
|
||||
let display_config = DisplayConfig::new(backend.connectors());
|
||||
let display_config = DisplayConfig::new(backend.enabled_outputs());
|
||||
dbus.conn_display_config = try_start(display_config);
|
||||
|
||||
let (to_niri, from_screenshot) = calloop::channel::channel();
|
||||
@ -75,7 +75,7 @@ impl DBusServers {
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
let screen_cast = ScreenCast::new(backend.connectors(), to_niri);
|
||||
let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri);
|
||||
dbus.conn_screen_cast = try_start(screen_cast);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use zbus::{dbus_interface, fdo};
|
||||
use super::Start;
|
||||
|
||||
pub struct DisplayConfig {
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Type)]
|
||||
@ -54,7 +54,7 @@ impl DisplayConfig {
|
||||
)> {
|
||||
// Construct the DBus response.
|
||||
let monitors: Vec<Monitor> = self
|
||||
.connectors
|
||||
.enabled_outputs
|
||||
.lock()
|
||||
.unwrap()
|
||||
.keys()
|
||||
@ -85,8 +85,8 @@ impl DisplayConfig {
|
||||
}
|
||||
|
||||
impl DisplayConfig {
|
||||
pub fn new(connectors: Arc<Mutex<HashMap<String, Output>>>) -> Self {
|
||||
Self { connectors }
|
||||
pub fn new(enabled_outputs: Arc<Mutex<HashMap<String, Output>>>) -> Self {
|
||||
Self { enabled_outputs }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use super::Start;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ScreenCast {
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
to_niri: calloop::channel::Sender<ScreenCastToNiri>,
|
||||
#[allow(clippy::type_complexity)]
|
||||
sessions: Arc<Mutex<Vec<(Session, InterfaceRef<Session>)>>>,
|
||||
@ -23,7 +23,7 @@ pub struct ScreenCast {
|
||||
#[derive(Clone)]
|
||||
pub struct Session {
|
||||
id: usize,
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
to_niri: calloop::channel::Sender<ScreenCastToNiri>,
|
||||
#[allow(clippy::type_complexity)]
|
||||
streams: Arc<Mutex<Vec<(Stream, InterfaceRef<Stream>)>>>,
|
||||
@ -84,7 +84,11 @@ impl ScreenCast {
|
||||
let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{}", session_id);
|
||||
let path = OwnedObjectPath::try_from(path).unwrap();
|
||||
|
||||
let session = Session::new(session_id, self.connectors.clone(), self.to_niri.clone());
|
||||
let session = Session::new(
|
||||
session_id,
|
||||
self.enabled_outputs.clone(),
|
||||
self.to_niri.clone(),
|
||||
);
|
||||
match server.at(&path, session.clone()).await {
|
||||
Ok(true) => {
|
||||
let iface = server.interface(&path).await.unwrap();
|
||||
@ -151,7 +155,7 @@ impl Session {
|
||||
) -> fdo::Result<OwnedObjectPath> {
|
||||
debug!(connector, ?properties, "record_monitor");
|
||||
|
||||
let Some(output) = self.connectors.lock().unwrap().get(connector).cloned() else {
|
||||
let Some(output) = self.enabled_outputs.lock().unwrap().get(connector).cloned() else {
|
||||
return Err(fdo::Error::Failed("no such monitor".to_owned()));
|
||||
};
|
||||
|
||||
@ -194,11 +198,11 @@ impl Stream {
|
||||
|
||||
impl ScreenCast {
|
||||
pub fn new(
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
to_niri: calloop::channel::Sender<ScreenCastToNiri>,
|
||||
) -> Self {
|
||||
Self {
|
||||
connectors,
|
||||
enabled_outputs,
|
||||
to_niri,
|
||||
sessions: Arc::new(Mutex::new(vec![])),
|
||||
}
|
||||
@ -223,12 +227,12 @@ impl Start for ScreenCast {
|
||||
impl Session {
|
||||
pub fn new(
|
||||
id: usize,
|
||||
connectors: Arc<Mutex<HashMap<String, Output>>>,
|
||||
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
|
||||
to_niri: calloop::channel::Sender<ScreenCastToNiri>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
connectors,
|
||||
enabled_outputs,
|
||||
streams: Arc::new(Mutex::new(vec![])),
|
||||
to_niri,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user