forge
Explore
Log in

Don't you dare go Hollow

Rename connectors to enabled_outputs

Browse files at this commit

768b32602839896012a9ee3c4ed6885360fa5395Ivan MolodetskikhParent: f068157
src/backend/mod.rsmodified+3 -3
@@ -111,10 +111,10 @@ impl Backend {
111111 }
112112
113113 #[cfg_attr(not(feature = "dbus"), allow(unused))]
114- pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
114+ pub fn enabled_outputs(&self) -> Arc<Mutex<HashMap<String, Output>>> {
115115 match self {
116- Backend::Tty(tty) => tty.connectors(),
117- Backend::Winit(winit) => winit.connectors(),
116+ Backend::Tty(tty) => tty.enabled_outputs(),
117+ Backend::Winit(winit) => winit.enabled_outputs(),
118118 }
119119 }
120120
src/backend/tty.rsmodified+6 -6
@@ -74,7 +74,7 @@ pub struct Tty {
7474 // The allocator for the primary GPU. It is only `Some()` if we have a device corresponding to
7575 // the primary GPU.
7676 primary_allocator: Option<DmabufAllocator<GbmAllocator<DrmDeviceFd>>>,
77- connectors: Arc<Mutex<HashMap<String, Output>>>,
77+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
7878 }
7979
8080 pub type TtyRenderer<'render, 'alloc> = MultiRenderer<
@@ -221,7 +221,7 @@ impl Tty {
221221 devices: HashMap::new(),
222222 dmabuf_global: None,
223223 primary_allocator: None,
224- connectors: Arc::new(Mutex::new(HashMap::new())),
224+ enabled_outputs: Arc::new(Mutex::new(HashMap::new())),
225225 }
226226 }
227227
@@ -736,7 +736,7 @@ impl Tty {
736736 let sequence_delta_plot_name =
737737 tracy_client::PlotName::new_leak(format!("{output_name} sequence delta"));
738738
739- self.connectors
739+ self.enabled_outputs
740740 .lock()
741741 .unwrap()
742742 .insert(output_name.clone(), output.clone());
@@ -794,7 +794,7 @@ impl Tty {
794794 error!("missing output for crtc {crtc:?}");
795795 };
796796
797- self.connectors.lock().unwrap().remove(&surface.name);
797+ self.enabled_outputs.lock().unwrap().remove(&surface.name);
798798 }
799799
800800 fn on_vblank(
@@ -1157,8 +1157,8 @@ impl Tty {
11571157 }
11581158 }
11591159
1160- pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
1161- self.connectors.clone()
1160+ pub fn enabled_outputs(&self) -> Arc<Mutex<HashMap<String, Output>>> {
1161+ self.enabled_outputs.clone()
11621162 }
11631163
11641164 #[cfg(feature = "xdp-gnome-screencast")]
src/backend/winit.rsmodified+5 -5
@@ -28,7 +28,7 @@ pub struct Winit {
2828 output: Output,
2929 backend: WinitGraphicsBackend<GlesRenderer>,
3030 damage_tracker: OutputDamageTracker,
31- connectors: Arc<Mutex<HashMap<String, Output>>>,
31+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
3232 }
3333
3434 impl Winit {
@@ -56,7 +56,7 @@ impl Winit {
5656 output.change_current_state(Some(mode), Some(Transform::Flipped180), None, None);
5757 output.set_preferred(mode);
5858
59- let connectors = Arc::new(Mutex::new(HashMap::from([(
59+ let enabled_outputs = Arc::new(Mutex::new(HashMap::from([(
6060 "winit".to_owned(),
6161 output.clone(),
6262 )])));
@@ -95,7 +95,7 @@ impl Winit {
9595 output,
9696 backend,
9797 damage_tracker,
98- connectors,
98+ enabled_outputs,
9999 }
100100 }
101101
@@ -198,7 +198,7 @@ impl Winit {
198198 }
199199 }
200200
201- pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
202- self.connectors.clone()
201+ pub fn enabled_outputs(&self) -> Arc<Mutex<HashMap<String, Output>>> {
202+ self.enabled_outputs.clone()
203203 }
204204 }
src/dbus/mod.rsmodified+2 -2
@@ -45,7 +45,7 @@ impl DBusServers {
4545 }
4646
4747 if is_session_instance || config.debug.dbus_interfaces_in_non_session_instances {
48- let display_config = DisplayConfig::new(backend.connectors());
48+ let display_config = DisplayConfig::new(backend.enabled_outputs());
4949 dbus.conn_display_config = try_start(display_config);
5050
5151 let (to_niri, from_screenshot) = calloop::channel::channel();
@@ -75,7 +75,7 @@ impl DBusServers {
7575 }
7676 })
7777 .unwrap();
78- let screen_cast = ScreenCast::new(backend.connectors(), to_niri);
78+ let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri);
7979 dbus.conn_screen_cast = try_start(screen_cast);
8080 }
8181 }
src/dbus/mutter_display_config.rsmodified+4 -4
@@ -10,7 +10,7 @@ use zbus::{dbus_interface, fdo};
1010 use super::Start;
1111
1212 pub struct DisplayConfig {
13- connectors: Arc<Mutex<HashMap<String, Output>>>,
13+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
1414 }
1515
1616 #[derive(Serialize, Type)]
@@ -54,7 +54,7 @@ impl DisplayConfig {
5454 )> {
5555 // Construct the DBus response.
5656 let monitors: Vec<Monitor> = self
57- .connectors
57+ .enabled_outputs
5858 .lock()
5959 .unwrap()
6060 .keys()
@@ -85,8 +85,8 @@ impl DisplayConfig {
8585 }
8686
8787 impl DisplayConfig {
88- pub fn new(connectors: Arc<Mutex<HashMap<String, Output>>>) -> Self {
89- Self { connectors }
88+ pub fn new(enabled_outputs: Arc<Mutex<HashMap<String, Output>>>) -> Self {
89+ Self { enabled_outputs }
9090 }
9191 }
9292
src/dbus/mutter_screen_cast.rsmodified+12 -8
@@ -14,7 +14,7 @@ use super::Start;
1414
1515 #[derive(Clone)]
1616 pub struct ScreenCast {
17- connectors: Arc<Mutex<HashMap<String, Output>>>,
17+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
1818 to_niri: calloop::channel::Sender<ScreenCastToNiri>,
1919 #[allow(clippy::type_complexity)]
2020 sessions: Arc<Mutex<Vec<(Session, InterfaceRef<Session>)>>>,
@@ -23,7 +23,7 @@ pub struct ScreenCast {
2323 #[derive(Clone)]
2424 pub struct Session {
2525 id: usize,
26- connectors: Arc<Mutex<HashMap<String, Output>>>,
26+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
2727 to_niri: calloop::channel::Sender<ScreenCastToNiri>,
2828 #[allow(clippy::type_complexity)]
2929 streams: Arc<Mutex<Vec<(Stream, InterfaceRef<Stream>)>>>,
@@ -84,7 +84,11 @@ impl ScreenCast {
8484 let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{}", session_id);
8585 let path = OwnedObjectPath::try_from(path).unwrap();
8686
87- let session = Session::new(session_id, self.connectors.clone(), self.to_niri.clone());
87+ let session = Session::new(
88+ session_id,
89+ self.enabled_outputs.clone(),
90+ self.to_niri.clone(),
91+ );
8892 match server.at(&path, session.clone()).await {
8993 Ok(true) => {
9094 let iface = server.interface(&path).await.unwrap();
@@ -151,7 +155,7 @@ impl Session {
151155 ) -> fdo::Result<OwnedObjectPath> {
152156 debug!(connector, ?properties, "record_monitor");
153157
154- let Some(output) = self.connectors.lock().unwrap().get(connector).cloned() else {
158+ let Some(output) = self.enabled_outputs.lock().unwrap().get(connector).cloned() else {
155159 return Err(fdo::Error::Failed("no such monitor".to_owned()));
156160 };
157161
@@ -194,11 +198,11 @@ impl Stream {
194198
195199 impl ScreenCast {
196200 pub fn new(
197- connectors: Arc<Mutex<HashMap<String, Output>>>,
201+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
198202 to_niri: calloop::channel::Sender<ScreenCastToNiri>,
199203 ) -> Self {
200204 Self {
201- connectors,
205+ enabled_outputs,
202206 to_niri,
203207 sessions: Arc::new(Mutex::new(vec![])),
204208 }
@@ -223,12 +227,12 @@ impl Start for ScreenCast {
223227 impl Session {
224228 pub fn new(
225229 id: usize,
226- connectors: Arc<Mutex<HashMap<String, Output>>>,
230+ enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
227231 to_niri: calloop::channel::Sender<ScreenCastToNiri>,
228232 ) -> Self {
229233 Self {
230234 id,
231- connectors,
235+ enabled_outputs,
232236 streams: Arc::new(Mutex::new(vec![])),
233237 to_niri,
234238 }