Rename connectors to enabled_outputs
Browse files at this commit768b32602839896012a9ee3c4ed6885360fa5395Parent: f0681576 changed files +32 -28
- src/backend/mod.rs +3 -3
- src/backend/tty.rs +6 -6
- src/backend/winit.rs +5 -5
- src/dbus/mod.rs +2 -2
- src/dbus/mutter_display_config.rs +4 -4
- src/dbus/mutter_screen_cast.rs +12 -8
src/backend/mod.rsmodified+3 -3
| @@ -111,10 +111,10 @@ impl Backend { | ||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | #[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>>> { | |
| 115 | 115 | 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(), | |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 |
src/backend/tty.rsmodified+6 -6
| @@ -74,7 +74,7 @@ pub struct Tty { | ||
| 74 | 74 | // The allocator for the primary GPU. It is only `Some()` if we have a device corresponding to |
| 75 | 75 | // the primary GPU. |
| 76 | 76 | primary_allocator: Option<DmabufAllocator<GbmAllocator<DrmDeviceFd>>>, |
| 77 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 77 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | pub type TtyRenderer<'render, 'alloc> = MultiRenderer< |
| @@ -221,7 +221,7 @@ impl Tty { | ||
| 221 | 221 | devices: HashMap::new(), |
| 222 | 222 | dmabuf_global: None, |
| 223 | 223 | primary_allocator: None, |
| 224 | - connectors: Arc::new(Mutex::new(HashMap::new())), | |
| 224 | + enabled_outputs: Arc::new(Mutex::new(HashMap::new())), | |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| @@ -736,7 +736,7 @@ impl Tty { | ||
| 736 | 736 | let sequence_delta_plot_name = |
| 737 | 737 | tracy_client::PlotName::new_leak(format!("{output_name} sequence delta")); |
| 738 | 738 | |
| 739 | - self.connectors | |
| 739 | + self.enabled_outputs | |
| 740 | 740 | .lock() |
| 741 | 741 | .unwrap() |
| 742 | 742 | .insert(output_name.clone(), output.clone()); |
| @@ -794,7 +794,7 @@ impl Tty { | ||
| 794 | 794 | error!("missing output for crtc {crtc:?}"); |
| 795 | 795 | }; |
| 796 | 796 | |
| 797 | - self.connectors.lock().unwrap().remove(&surface.name); | |
| 797 | + self.enabled_outputs.lock().unwrap().remove(&surface.name); | |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | fn on_vblank( |
| @@ -1157,8 +1157,8 @@ impl Tty { | ||
| 1157 | 1157 | } |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 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() | |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | #[cfg(feature = "xdp-gnome-screencast")] |
src/backend/winit.rsmodified+5 -5
| @@ -28,7 +28,7 @@ pub struct Winit { | ||
| 28 | 28 | output: Output, |
| 29 | 29 | backend: WinitGraphicsBackend<GlesRenderer>, |
| 30 | 30 | damage_tracker: OutputDamageTracker, |
| 31 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 31 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | impl Winit { |
| @@ -56,7 +56,7 @@ impl Winit { | ||
| 56 | 56 | output.change_current_state(Some(mode), Some(Transform::Flipped180), None, None); |
| 57 | 57 | output.set_preferred(mode); |
| 58 | 58 | |
| 59 | - let connectors = Arc::new(Mutex::new(HashMap::from([( | |
| 59 | + let enabled_outputs = Arc::new(Mutex::new(HashMap::from([( | |
| 60 | 60 | "winit".to_owned(), |
| 61 | 61 | output.clone(), |
| 62 | 62 | )]))); |
| @@ -95,7 +95,7 @@ impl Winit { | ||
| 95 | 95 | output, |
| 96 | 96 | backend, |
| 97 | 97 | damage_tracker, |
| 98 | - connectors, | |
| 98 | + enabled_outputs, | |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| @@ -198,7 +198,7 @@ impl Winit { | ||
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 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() | |
| 203 | 203 | } |
| 204 | 204 | } |
src/dbus/mod.rsmodified+2 -2
| @@ -45,7 +45,7 @@ impl DBusServers { | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | 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()); | |
| 49 | 49 | dbus.conn_display_config = try_start(display_config); |
| 50 | 50 | |
| 51 | 51 | let (to_niri, from_screenshot) = calloop::channel::channel(); |
| @@ -75,7 +75,7 @@ impl DBusServers { | ||
| 75 | 75 | } |
| 76 | 76 | }) |
| 77 | 77 | .unwrap(); |
| 78 | - let screen_cast = ScreenCast::new(backend.connectors(), to_niri); | |
| 78 | + let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri); | |
| 79 | 79 | dbus.conn_screen_cast = try_start(screen_cast); |
| 80 | 80 | } |
| 81 | 81 | } |
src/dbus/mutter_display_config.rsmodified+4 -4
| @@ -10,7 +10,7 @@ use zbus::{dbus_interface, fdo}; | ||
| 10 | 10 | use super::Start; |
| 11 | 11 | |
| 12 | 12 | pub struct DisplayConfig { |
| 13 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 13 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | #[derive(Serialize, Type)] |
| @@ -54,7 +54,7 @@ impl DisplayConfig { | ||
| 54 | 54 | )> { |
| 55 | 55 | // Construct the DBus response. |
| 56 | 56 | let monitors: Vec<Monitor> = self |
| 57 | - .connectors | |
| 57 | + .enabled_outputs | |
| 58 | 58 | .lock() |
| 59 | 59 | .unwrap() |
| 60 | 60 | .keys() |
| @@ -85,8 +85,8 @@ impl DisplayConfig { | ||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | 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 } | |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 |
src/dbus/mutter_screen_cast.rsmodified+12 -8
| @@ -14,7 +14,7 @@ use super::Start; | ||
| 14 | 14 | |
| 15 | 15 | #[derive(Clone)] |
| 16 | 16 | pub struct ScreenCast { |
| 17 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 17 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 18 | 18 | to_niri: calloop::channel::Sender<ScreenCastToNiri>, |
| 19 | 19 | #[allow(clippy::type_complexity)] |
| 20 | 20 | sessions: Arc<Mutex<Vec<(Session, InterfaceRef<Session>)>>>, |
| @@ -23,7 +23,7 @@ pub struct ScreenCast { | ||
| 23 | 23 | #[derive(Clone)] |
| 24 | 24 | pub struct Session { |
| 25 | 25 | id: usize, |
| 26 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 26 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 27 | 27 | to_niri: calloop::channel::Sender<ScreenCastToNiri>, |
| 28 | 28 | #[allow(clippy::type_complexity)] |
| 29 | 29 | streams: Arc<Mutex<Vec<(Stream, InterfaceRef<Stream>)>>>, |
| @@ -84,7 +84,11 @@ impl ScreenCast { | ||
| 84 | 84 | let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{}", session_id); |
| 85 | 85 | let path = OwnedObjectPath::try_from(path).unwrap(); |
| 86 | 86 | |
| 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 | + ); | |
| 88 | 92 | match server.at(&path, session.clone()).await { |
| 89 | 93 | Ok(true) => { |
| 90 | 94 | let iface = server.interface(&path).await.unwrap(); |
| @@ -151,7 +155,7 @@ impl Session { | ||
| 151 | 155 | ) -> fdo::Result<OwnedObjectPath> { |
| 152 | 156 | debug!(connector, ?properties, "record_monitor"); |
| 153 | 157 | |
| 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 { | |
| 155 | 159 | return Err(fdo::Error::Failed("no such monitor".to_owned())); |
| 156 | 160 | }; |
| 157 | 161 | |
| @@ -194,11 +198,11 @@ impl Stream { | ||
| 194 | 198 | |
| 195 | 199 | impl ScreenCast { |
| 196 | 200 | pub fn new( |
| 197 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 201 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 198 | 202 | to_niri: calloop::channel::Sender<ScreenCastToNiri>, |
| 199 | 203 | ) -> Self { |
| 200 | 204 | Self { |
| 201 | - connectors, | |
| 205 | + enabled_outputs, | |
| 202 | 206 | to_niri, |
| 203 | 207 | sessions: Arc::new(Mutex::new(vec![])), |
| 204 | 208 | } |
| @@ -223,12 +227,12 @@ impl Start for ScreenCast { | ||
| 223 | 227 | impl Session { |
| 224 | 228 | pub fn new( |
| 225 | 229 | id: usize, |
| 226 | - connectors: Arc<Mutex<HashMap<String, Output>>>, | |
| 230 | + enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, | |
| 227 | 231 | to_niri: calloop::channel::Sender<ScreenCastToNiri>, |
| 228 | 232 | ) -> Self { |
| 229 | 233 | Self { |
| 230 | 234 | id, |
| 231 | - connectors, | |
| 235 | + enabled_outputs, | |
| 232 | 236 | streams: Arc::new(Mutex::new(vec![])), |
| 233 | 237 | to_niri, |
| 234 | 238 | } |