diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-05 10:08:56 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-10 07:29:33 -0800 |
| commit | bfd81fc2904ba35ae7ccb979e8cb4b2d244fb2dd (patch) | |
| tree | c455520f14e7e852aeff06778ec35cc68a93b541 /src/layout | |
| parent | 0dd8e883b092d4bcd735bec45c8cff3d86a4f991 (diff) | |
| download | niri-bfd81fc2904ba35ae7ccb979e8cb4b2d244fb2dd.tar.gz niri-bfd81fc2904ba35ae7ccb979e8cb4b2d244fb2dd.tar.bz2 niri-bfd81fc2904ba35ae7ccb979e8cb4b2d244fb2dd.zip | |
Make send_frame() a function on Mapped
We'll add some extra logic there.
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/mod.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index a49ec0e6..ae338ced 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -476,6 +476,13 @@ impl<W: LayoutElement> InteractiveMoveState<W> { _ => None, } } + + fn moving_mut(&mut self) -> Option<&mut InteractiveMoveData<W>> { + match self { + InteractiveMoveState::Moving(move_) => Some(move_), + _ => None, + } + } } impl<W: LayoutElement> InteractiveMoveData<W> { @@ -1608,6 +1615,28 @@ impl<W: LayoutElement> Layout<W> { moving_window.chain(mon_windows) } + pub fn windows_for_output_mut(&mut self, output: &Output) -> impl Iterator<Item = &mut W> + '_ { + let MonitorSet::Normal { monitors, .. } = &mut self.monitor_set else { + panic!() + }; + + let moving_window = self + .interactive_move + .as_mut() + .and_then(|x| x.moving_mut()) + .filter(|move_| move_.output == *output) + .map(|move_| move_.tile.window_mut()) + .into_iter(); + + let mon = monitors + .iter_mut() + .find(|mon| &mon.output == output) + .unwrap(); + let mon_windows = mon.workspaces.iter_mut().flat_map(|ws| ws.windows_mut()); + + moving_window.chain(mon_windows) + } + pub fn with_windows(&self, mut f: impl FnMut(&W, Option<&Output>, Option<WorkspaceId>)) { if let Some(InteractiveMoveState::Moving(move_)) = &self.interactive_move { f(move_.tile.window(), Some(&move_.output), None); |
