diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-15 11:18:54 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-15 11:18:54 +0300 |
| commit | cee2ec7ab73284193c04f01309219e0a5ef67a25 (patch) | |
| tree | ab39abac9d4908b227ab2767697f217da99db2e8 | |
| parent | 8c4ebb00a1e7512dc00ac3418a9cf67322e7000c (diff) | |
| download | niri-cee2ec7ab73284193c04f01309219e0a5ef67a25.tar.gz niri-cee2ec7ab73284193c04f01309219e0a5ef67a25.tar.bz2 niri-cee2ec7ab73284193c04f01309219e0a5ef67a25.zip | |
Use windows() instead of with_windows()
| -rw-r--r-- | src/niri.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/niri.rs b/src/niri.rs index a045e4dd..59e3edf7 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1723,16 +1723,9 @@ impl State { (CastTarget::Output(output.downgrade()), size, refresh, false) } StreamTargetId::Window { id } => { - let mut window = None; - self.niri.layout.with_windows(|mapped, _, _| { - if mapped.id().get() != id { - return; - } - - window = Some(mapped.window.clone()); - }); - - let Some(window) = window else { + let Some(window) = self.niri.layout.windows().find_map(|(_, mapped)| { + (mapped.id().get() == id).then_some(&mapped.window) + }) else { warn!("error starting screencast: requested window is missing"); self.niri.stop_cast(session_id); return; @@ -1740,7 +1733,7 @@ impl State { // Use the cached output since it will be present even if the output was // currently disconnected. - let Some(output) = self.niri.mapped_cast_output.get(&window) else { + let Some(output) = self.niri.mapped_cast_output.get(window) else { warn!("error starting screencast: requested window is missing"); self.niri.stop_cast(session_id); return; |
