diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 0f346174..3cf67863 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -1252,10 +1252,6 @@ impl TilingLayout { } } - pub fn output_for_element(&self, elem: &CosmicMapped) -> Option<&Output> { - self.mapped().find_map(|(o, m, _)| (m == elem).then_some(o)) - } - // TODO: Move would needs this to be accurate during animations pub fn element_geometry(&self, elem: &CosmicMapped) -> Option> { if let Some(id) = elem.tiling_node_id.lock().unwrap().as_ref() { @@ -2101,14 +2097,14 @@ impl TilingLayout { let dead_windows = self .mapped() - .map(|(_, w, _)| w.clone()) + .map(|(w, _)| w.clone()) .filter(|w| !w.alive()) .collect::>(); for dead_window in dead_windows.iter() { self.unmap_window_internal(dead_window); } - for (_, mapped, _) in self.mapped() { + for (mapped, _) in self.mapped() { mapped.refresh(); } } @@ -3428,7 +3424,7 @@ impl TilingLayout { } } - pub fn mapped(&self) -> impl Iterator)> { + pub fn mapped(&self) -> impl Iterator)> { let tree = &self.queue.trees.back().unwrap().0; let iter = if let Some(root) = tree.root_node_id() { Some( @@ -3444,10 +3440,7 @@ impl TilingLayout { mapped, last_geometry, .. - } => (&self.output, mapped, { - let geo = last_geometry.clone(); - geo.to_global(&self.output) - }), + } => (mapped, last_geometry.clone()), _ => unreachable!(), }) .chain( @@ -3463,10 +3456,7 @@ impl TilingLayout { mapped, last_geometry, .. - } => (&self.output, mapped, { - let geo = last_geometry.clone(); - geo.to_global(&self.output) - }), + } => (mapped, last_geometry.clone()), _ => unreachable!(), }), ), @@ -3477,15 +3467,13 @@ impl TilingLayout { iter.into_iter().flatten() } - pub fn windows( - &self, - ) -> impl Iterator)> + '_ { - self.mapped().flat_map(|(output, mapped, geo)| { + pub fn windows(&self) -> impl Iterator)> + '_ { + self.mapped().flat_map(|(mapped, geo)| { mapped.windows().map(move |(w, p)| { - (output.clone(), w, { + (w, { let mut geo = geo.clone(); - geo.loc += p.as_global(); - geo.size -= p.to_size().as_global(); + geo.loc += p.as_local(); + geo.size -= p.to_size().as_local(); geo }) }) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index aafb88ed..a102ccb4 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1089,7 +1089,7 @@ impl Shell { for window in set.workspaces[set.active] .tiling_layer .mapped() - .map(|(_, w, _)| w) + .map(|(w, _)| w) .chain(set.workspaces[set.active].floating_layer.space.elements()) { if let Some(surf) = window.active_window().x11_surface() { @@ -2242,7 +2242,7 @@ impl Shell { workspace .tiling_layer .mapped() - .any(|(_, m, _)| m == &old_mapped) + .any(|(m, _)| m == &old_mapped) } .then_some(ManagedLayer::Tiling) .unwrap_or(ManagedLayer::Floating); @@ -2803,7 +2803,7 @@ impl Shell { { set.sticky_layer.toggle_stacking(window) } else if let Some(workspace) = self.space_for_mut(window) { - if workspace.tiling_layer.mapped().any(|(_, m, _)| m == window) { + if workspace.tiling_layer.mapped().any(|(m, _)| m == window) { workspace.tiling_layer.toggle_stacking(window) } else if workspace.floating_layer.mapped().any(|w| w == window) { workspace.floating_layer.toggle_stacking(window) @@ -2823,11 +2823,7 @@ impl Shell { if set.sticky_layer.mapped().any(|m| m == &window) { set.sticky_layer .toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat)) - } else if workspace - .tiling_layer - .mapped() - .any(|(_, m, _)| m == &window) - { + } else if workspace.tiling_layer.mapped().any(|(m, _)| m == &window) { workspace .tiling_layer .toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat)) diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index b83761a3..7a9536de 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -405,14 +405,14 @@ impl Workspace { pub fn element_for_surface(&self, surface: &CosmicSurface) -> Option<&CosmicMapped> { self.floating_layer .mapped() - .chain(self.tiling_layer.mapped().map(|(_, w, _)| w)) + .chain(self.tiling_layer.mapped().map(|(w, _)| w)) .find(|e| e.windows().any(|(w, _)| &w == surface)) } pub fn element_for_wl_surface(&self, surface: &WlSurface) -> Option<&CosmicMapped> { self.floating_layer .mapped() - .chain(self.tiling_layer.mapped().map(|(_, w, _)| w)) + .chain(self.tiling_layer.mapped().map(|(w, _)| w)) .find(|e| { e.windows() .any(|(w, _)| w.wl_surface().as_ref() == Some(surface)) @@ -422,7 +422,7 @@ impl Workspace { pub fn element_for_x11_surface(&self, surface: &X11Surface) -> Option<&CosmicMapped> { self.floating_layer .mapped() - .chain(self.tiling_layer.mapped().map(|(_, w, _)| w)) + .chain(self.tiling_layer.mapped().map(|(w, _)| w)) .find(|e| e.windows().any(|(w, _)| w.x11_surface() == Some(surface))) } @@ -654,7 +654,7 @@ impl Workspace { for window in self .tiling_layer .mapped() - .map(|(_, m, _)| m.clone()) + .map(|(m, _)| m.clone()) .collect::>() .into_iter() { @@ -671,7 +671,7 @@ impl Workspace { if window.is_maximized(false) { self.unmaximize_request(window); } - if self.tiling_layer.mapped().any(|(_, m, _)| m == window) { + if self.tiling_layer.mapped().any(|(m, _)| m == window) { self.tiling_layer.unmap(window); self.floating_layer.map(window.clone(), None); } else if self.floating_layer.mapped().any(|w| w == window) { @@ -693,7 +693,7 @@ impl Workspace { pub fn mapped(&self) -> impl Iterator { self.floating_layer .mapped() - .chain(self.tiling_layer.mapped().map(|(_, w, _)| w)) + .chain(self.tiling_layer.mapped().map(|(w, _)| w)) } pub fn outputs(&self) -> impl Iterator { @@ -703,7 +703,7 @@ impl Workspace { pub fn windows(&self) -> impl Iterator + '_ { self.floating_layer .windows() - .chain(self.tiling_layer.windows().map(|(_, w, _)| w)) + .chain(self.tiling_layer.windows().map(|(w, _)| w)) } pub fn is_fullscreen(&self, mapped: &CosmicMapped) -> bool { @@ -717,13 +717,13 @@ impl Workspace { } pub fn is_tiled(&self, mapped: &CosmicMapped) -> bool { - !self.is_fullscreen(mapped) && self.tiling_layer.mapped().any(|(_, m, _)| m == mapped) + !self.is_fullscreen(mapped) && self.tiling_layer.mapped().any(|(m, _)| m == mapped) } pub fn node_desc(&self, focus: KeyboardFocusTarget) -> Option { match focus { KeyboardFocusTarget::Element(mapped) => { - self.tiling_layer.mapped().find_map(|(_, m, _)| { + self.tiling_layer.mapped().find_map(|(m, _)| { if m == &mapped { mapped .tiling_node_id