freedesktop_a11y: Name keyboard structs as such
Browse files at this commitf036de655d309edc13fef545a3809330796cbe83Parent: e83850f1 changed file +12 -11
- src/dbus/freedesktop_a11y.rs +12 -11
src/dbus/freedesktop_a11y.rsmodified+12 -11
| @@ -35,8 +35,8 @@ pub enum NiriToA11yManager { | ||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | #[derive(Debug, Default)] |
| 38 | -struct Data { | |
| 39 | - clients: HashMap<OwnedUniqueName, Client>, | |
| 38 | +struct KeyboardData { | |
| 39 | + clients: HashMap<OwnedUniqueName, KeyboardClient>, | |
| 40 | 40 | |
| 41 | 41 | grabbed_mods: HashSet<Keysym>, |
| 42 | 42 | grabbed_mod_last_press_time: HashMap<Keysym, Duration>, |
| @@ -44,7 +44,7 @@ struct Data { | ||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | #[derive(Debug, Default)] |
| 47 | -struct Client { | |
| 47 | +struct KeyboardClient { | |
| 48 | 48 | watched: bool, |
| 49 | 49 | grabbed: bool, |
| 50 | 50 | modifiers: HashSet<Keysym>, |
| @@ -53,7 +53,7 @@ struct Client { | ||
| 53 | 53 | |
| 54 | 54 | #[derive(Clone, Default)] |
| 55 | 55 | pub struct KeyboardMonitor { |
| 56 | - data: Arc<Mutex<Data>>, | |
| 56 | + data: Arc<Mutex<KeyboardData>>, | |
| 57 | 57 | iface: Arc<OnceLock<InterfaceRef<Self>>>, |
| 58 | 58 | } |
| 59 | 59 | |
| @@ -352,7 +352,7 @@ impl KeyboardMonitor { | ||
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -impl Data { | |
| 355 | +impl KeyboardData { | |
| 356 | 356 | fn rebuild_grabbed_mods(&mut self) { |
| 357 | 357 | self.grabbed_mods.clear(); |
| 358 | 358 | for client in self.clients.values() { |
| @@ -361,7 +361,7 @@ impl Data { | ||
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | -impl Client { | |
| 364 | +impl KeyboardClient { | |
| 365 | 365 | fn should_grab_keypress( |
| 366 | 366 | &self, |
| 367 | 367 | suppressed_keys: &HashSet<Keysym>, |
| @@ -505,7 +505,7 @@ impl PointerLocator { | ||
| 505 | 505 | |
| 506 | 506 | async fn monitor_disappeared_clients( |
| 507 | 507 | conn: &zbus::Connection, |
| 508 | - data: Arc<Mutex<Data>>, | |
| 508 | + kb_data: Arc<Mutex<KeyboardData>>, | |
| 509 | 509 | pointer_data: Arc<Mutex<PointerData>>, |
| 510 | 510 | ) -> anyhow::Result<()> { |
| 511 | 511 | let proxy = fdo::DBusProxy::new(conn) |
| @@ -531,7 +531,7 @@ async fn monitor_disappeared_clients( | ||
| 531 | 531 | |
| 532 | 532 | let name = OwnedUniqueName::from(name.to_owned()); |
| 533 | 533 | { |
| 534 | - let mut data = data.lock().unwrap(); | |
| 534 | + let mut data = kb_data.lock().unwrap(); | |
| 535 | 535 | data.clients.remove(&name); |
| 536 | 536 | data.rebuild_grabbed_mods(); |
| 537 | 537 | } |
| @@ -589,13 +589,14 @@ impl Manager { | ||
| 589 | 589 | .interface("/org/freedesktop/a11y/Manager")?; |
| 590 | 590 | let _ = self.pointer_locator.iface.set(iface); |
| 591 | 591 | |
| 592 | - let data = self.keyboard_monitor.data.clone(); | |
| 592 | + let kb_data = self.keyboard_monitor.data.clone(); | |
| 593 | 593 | let pointer_data = self.pointer_locator.data.clone(); |
| 594 | 594 | |
| 595 | 595 | let async_conn = conn.inner().clone(); |
| 596 | 596 | let future = async move { |
| 597 | 597 | if let Err(err) = |
| 598 | - monitor_disappeared_clients(&async_conn, data.clone(), pointer_data.clone()).await | |
| 598 | + monitor_disappeared_clients(&async_conn, kb_data.clone(), pointer_data.clone()) | |
| 599 | + .await | |
| 599 | 600 | { |
| 600 | 601 | warn!("error monitoring keyboard monitor clients: {err:?}"); |
| 601 | 602 | |
| @@ -605,7 +606,7 @@ impl Manager { | ||
| 605 | 606 | } |
| 606 | 607 | |
| 607 | 608 | { |
| 608 | - let mut data = data.lock().unwrap(); | |
| 609 | + let mut data = kb_data.lock().unwrap(); | |
| 609 | 610 | data.clients.clear(); |
| 610 | 611 | data.rebuild_grabbed_mods(); |
| 611 | 612 | } |