tiling: Cleanup old code from spanning outputs
This commit is contained in:
parent
134bb9f59b
commit
a668df27ae
3 changed files with 23 additions and 39 deletions
|
|
@ -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<Rectangle<i32, Local>> {
|
||||
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::<Vec<_>>();
|
||||
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<Item = (&Output, &CosmicMapped, Rectangle<i32, Global>)> {
|
||||
pub fn mapped(&self) -> impl Iterator<Item = (&CosmicMapped, Rectangle<i32, Local>)> {
|
||||
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<Item = (Output, CosmicSurface, Rectangle<i32, Global>)> + '_ {
|
||||
self.mapped().flat_map(|(output, mapped, geo)| {
|
||||
pub fn windows(&self) -> impl Iterator<Item = (CosmicSurface, Rectangle<i32, Local>)> + '_ {
|
||||
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
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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::<Vec<_>>()
|
||||
.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<Item = &CosmicMapped> {
|
||||
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<Item = &Output> {
|
||||
|
|
@ -703,7 +703,7 @@ impl Workspace {
|
|||
pub fn windows(&self) -> impl Iterator<Item = CosmicSurface> + '_ {
|
||||
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<NodeDesc> {
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue