aboutsummaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/mod.rs29
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);