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
|
// TODO: Move would needs this to be accurate during animations
|
||||||
pub fn element_geometry(&self, elem: &CosmicMapped) -> Option<Rectangle<i32, Local>> {
|
pub fn element_geometry(&self, elem: &CosmicMapped) -> Option<Rectangle<i32, Local>> {
|
||||||
if let Some(id) = elem.tiling_node_id.lock().unwrap().as_ref() {
|
if let Some(id) = elem.tiling_node_id.lock().unwrap().as_ref() {
|
||||||
|
|
@ -2101,14 +2097,14 @@ impl TilingLayout {
|
||||||
|
|
||||||
let dead_windows = self
|
let dead_windows = self
|
||||||
.mapped()
|
.mapped()
|
||||||
.map(|(_, w, _)| w.clone())
|
.map(|(w, _)| w.clone())
|
||||||
.filter(|w| !w.alive())
|
.filter(|w| !w.alive())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
for dead_window in dead_windows.iter() {
|
for dead_window in dead_windows.iter() {
|
||||||
self.unmap_window_internal(dead_window);
|
self.unmap_window_internal(dead_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (_, mapped, _) in self.mapped() {
|
for (mapped, _) in self.mapped() {
|
||||||
mapped.refresh();
|
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 tree = &self.queue.trees.back().unwrap().0;
|
||||||
let iter = if let Some(root) = tree.root_node_id() {
|
let iter = if let Some(root) = tree.root_node_id() {
|
||||||
Some(
|
Some(
|
||||||
|
|
@ -3444,10 +3440,7 @@ impl TilingLayout {
|
||||||
mapped,
|
mapped,
|
||||||
last_geometry,
|
last_geometry,
|
||||||
..
|
..
|
||||||
} => (&self.output, mapped, {
|
} => (mapped, last_geometry.clone()),
|
||||||
let geo = last_geometry.clone();
|
|
||||||
geo.to_global(&self.output)
|
|
||||||
}),
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
})
|
})
|
||||||
.chain(
|
.chain(
|
||||||
|
|
@ -3463,10 +3456,7 @@ impl TilingLayout {
|
||||||
mapped,
|
mapped,
|
||||||
last_geometry,
|
last_geometry,
|
||||||
..
|
..
|
||||||
} => (&self.output, mapped, {
|
} => (mapped, last_geometry.clone()),
|
||||||
let geo = last_geometry.clone();
|
|
||||||
geo.to_global(&self.output)
|
|
||||||
}),
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
@ -3477,15 +3467,13 @@ impl TilingLayout {
|
||||||
iter.into_iter().flatten()
|
iter.into_iter().flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn windows(
|
pub fn windows(&self) -> impl Iterator<Item = (CosmicSurface, Rectangle<i32, Local>)> + '_ {
|
||||||
&self,
|
self.mapped().flat_map(|(mapped, geo)| {
|
||||||
) -> impl Iterator<Item = (Output, CosmicSurface, Rectangle<i32, Global>)> + '_ {
|
|
||||||
self.mapped().flat_map(|(output, mapped, geo)| {
|
|
||||||
mapped.windows().map(move |(w, p)| {
|
mapped.windows().map(move |(w, p)| {
|
||||||
(output.clone(), w, {
|
(w, {
|
||||||
let mut geo = geo.clone();
|
let mut geo = geo.clone();
|
||||||
geo.loc += p.as_global();
|
geo.loc += p.as_local();
|
||||||
geo.size -= p.to_size().as_global();
|
geo.size -= p.to_size().as_local();
|
||||||
geo
|
geo
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1089,7 +1089,7 @@ impl Shell {
|
||||||
for window in set.workspaces[set.active]
|
for window in set.workspaces[set.active]
|
||||||
.tiling_layer
|
.tiling_layer
|
||||||
.mapped()
|
.mapped()
|
||||||
.map(|(_, w, _)| w)
|
.map(|(w, _)| w)
|
||||||
.chain(set.workspaces[set.active].floating_layer.space.elements())
|
.chain(set.workspaces[set.active].floating_layer.space.elements())
|
||||||
{
|
{
|
||||||
if let Some(surf) = window.active_window().x11_surface() {
|
if let Some(surf) = window.active_window().x11_surface() {
|
||||||
|
|
@ -2242,7 +2242,7 @@ impl Shell {
|
||||||
workspace
|
workspace
|
||||||
.tiling_layer
|
.tiling_layer
|
||||||
.mapped()
|
.mapped()
|
||||||
.any(|(_, m, _)| m == &old_mapped)
|
.any(|(m, _)| m == &old_mapped)
|
||||||
}
|
}
|
||||||
.then_some(ManagedLayer::Tiling)
|
.then_some(ManagedLayer::Tiling)
|
||||||
.unwrap_or(ManagedLayer::Floating);
|
.unwrap_or(ManagedLayer::Floating);
|
||||||
|
|
@ -2803,7 +2803,7 @@ impl Shell {
|
||||||
{
|
{
|
||||||
set.sticky_layer.toggle_stacking(window)
|
set.sticky_layer.toggle_stacking(window)
|
||||||
} else if let Some(workspace) = self.space_for_mut(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)
|
workspace.tiling_layer.toggle_stacking(window)
|
||||||
} else if workspace.floating_layer.mapped().any(|w| w == window) {
|
} else if workspace.floating_layer.mapped().any(|w| w == window) {
|
||||||
workspace.floating_layer.toggle_stacking(window)
|
workspace.floating_layer.toggle_stacking(window)
|
||||||
|
|
@ -2823,11 +2823,7 @@ impl Shell {
|
||||||
if set.sticky_layer.mapped().any(|m| m == &window) {
|
if set.sticky_layer.mapped().any(|m| m == &window) {
|
||||||
set.sticky_layer
|
set.sticky_layer
|
||||||
.toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat))
|
.toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat))
|
||||||
} else if workspace
|
} else if workspace.tiling_layer.mapped().any(|(m, _)| m == &window) {
|
||||||
.tiling_layer
|
|
||||||
.mapped()
|
|
||||||
.any(|(_, m, _)| m == &window)
|
|
||||||
{
|
|
||||||
workspace
|
workspace
|
||||||
.tiling_layer
|
.tiling_layer
|
||||||
.toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat))
|
.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> {
|
pub fn element_for_surface(&self, surface: &CosmicSurface) -> Option<&CosmicMapped> {
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.mapped()
|
.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))
|
.find(|e| e.windows().any(|(w, _)| &w == surface))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn element_for_wl_surface(&self, surface: &WlSurface) -> Option<&CosmicMapped> {
|
pub fn element_for_wl_surface(&self, surface: &WlSurface) -> Option<&CosmicMapped> {
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.mapped()
|
.mapped()
|
||||||
.chain(self.tiling_layer.mapped().map(|(_, w, _)| w))
|
.chain(self.tiling_layer.mapped().map(|(w, _)| w))
|
||||||
.find(|e| {
|
.find(|e| {
|
||||||
e.windows()
|
e.windows()
|
||||||
.any(|(w, _)| w.wl_surface().as_ref() == Some(surface))
|
.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> {
|
pub fn element_for_x11_surface(&self, surface: &X11Surface) -> Option<&CosmicMapped> {
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.mapped()
|
.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)))
|
.find(|e| e.windows().any(|(w, _)| w.x11_surface() == Some(surface)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -654,7 +654,7 @@ impl Workspace {
|
||||||
for window in self
|
for window in self
|
||||||
.tiling_layer
|
.tiling_layer
|
||||||
.mapped()
|
.mapped()
|
||||||
.map(|(_, m, _)| m.clone())
|
.map(|(m, _)| m.clone())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
{
|
{
|
||||||
|
|
@ -671,7 +671,7 @@ impl Workspace {
|
||||||
if window.is_maximized(false) {
|
if window.is_maximized(false) {
|
||||||
self.unmaximize_request(window);
|
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.tiling_layer.unmap(window);
|
||||||
self.floating_layer.map(window.clone(), None);
|
self.floating_layer.map(window.clone(), None);
|
||||||
} else if self.floating_layer.mapped().any(|w| w == window) {
|
} else if self.floating_layer.mapped().any(|w| w == window) {
|
||||||
|
|
@ -693,7 +693,7 @@ impl Workspace {
|
||||||
pub fn mapped(&self) -> impl Iterator<Item = &CosmicMapped> {
|
pub fn mapped(&self) -> impl Iterator<Item = &CosmicMapped> {
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.mapped()
|
.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> {
|
pub fn outputs(&self) -> impl Iterator<Item = &Output> {
|
||||||
|
|
@ -703,7 +703,7 @@ impl Workspace {
|
||||||
pub fn windows(&self) -> impl Iterator<Item = CosmicSurface> + '_ {
|
pub fn windows(&self) -> impl Iterator<Item = CosmicSurface> + '_ {
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.windows()
|
.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 {
|
pub fn is_fullscreen(&self, mapped: &CosmicMapped) -> bool {
|
||||||
|
|
@ -717,13 +717,13 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_tiled(&self, mapped: &CosmicMapped) -> bool {
|
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> {
|
pub fn node_desc(&self, focus: KeyboardFocusTarget) -> Option<NodeDesc> {
|
||||||
match focus {
|
match focus {
|
||||||
KeyboardFocusTarget::Element(mapped) => {
|
KeyboardFocusTarget::Element(mapped) => {
|
||||||
self.tiling_layer.mapped().find_map(|(_, m, _)| {
|
self.tiling_layer.mapped().find_map(|(m, _)| {
|
||||||
if m == &mapped {
|
if m == &mapped {
|
||||||
mapped
|
mapped
|
||||||
.tiling_node_id
|
.tiling_node_id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue