Use windows() instead of with_windows()
Browse files at this commitcee2ec7ab73284193c04f01309219e0a5ef67a25Parent: 8c4ebb01 changed file +4 -11
- src/niri.rs +4 -11
src/niri.rsmodified+4 -11
| @@ -1723,16 +1723,9 @@ impl State { | |||
| 1723 | (CastTarget::Output(output.downgrade()), size, refresh, false) | 1723 | (CastTarget::Output(output.downgrade()), size, refresh, false) |
| 1724 | } | 1724 | } |
| 1725 | StreamTargetId::Window { id } => { | 1725 | StreamTargetId::Window { id } => { |
| 1726 | - let mut window = None; | 1726 | + let Some(window) = self.niri.layout.windows().find_map(|(_, mapped)| { |
| 1727 | - self.niri.layout.with_windows(|mapped, _, _| { | 1727 | + (mapped.id().get() == id).then_some(&mapped.window) |
| 1728 | - if mapped.id().get() != id { | 1728 | + }) else { |
| 1729 | - return; | ||
| 1730 | - } | ||
| 1731 | - | ||
| 1732 | - window = Some(mapped.window.clone()); | ||
| 1733 | - }); | ||
| 1734 | - | ||
| 1735 | - let Some(window) = window else { | ||
| 1736 | warn!("error starting screencast: requested window is missing"); | 1729 | warn!("error starting screencast: requested window is missing"); |
| 1737 | self.niri.stop_cast(session_id); | 1730 | self.niri.stop_cast(session_id); |
| 1738 | return; | 1731 | return; |
| @@ -1740,7 +1733,7 @@ impl State { | |||
| 1740 | 1733 | ||
| 1741 | // Use the cached output since it will be present even if the output was | 1734 | // Use the cached output since it will be present even if the output was |
| 1742 | // currently disconnected. | 1735 | // currently disconnected. |
| 1743 | - let Some(output) = self.niri.mapped_cast_output.get(&window) else { | 1736 | + let Some(output) = self.niri.mapped_cast_output.get(window) else { |
| 1744 | warn!("error starting screencast: requested window is missing"); | 1737 | warn!("error starting screencast: requested window is missing"); |
| 1745 | self.niri.stop_cast(session_id); | 1738 | self.niri.stop_cast(session_id); |
| 1746 | return; | 1739 | return; |